Anti Aliasing Text in 4V

Learn to display text using the Anti-Aliasing Text View

Android provides reusable views like the TextView to render text in Android Applications. While displaying text using a TextView, it can often appear aliased and pixelated when the backlight is turned on.

The Android Media SDK provides the AntialiasingTextView which extends the functionality of a TextView to fix this issue.

You can use the AntiAliasingTextView in your app, if you need to display text along with your Media in 4V.

Using the AntiAliasingTextView

The AntialiasingTextView is a subclass of the TextView and therefore works exactly like it

Setting text in XML

The following snippet shows how to add the AntialiasingTextView to your layout's XML file.

<com.leiainc.androidsdk.core.AntialiasingTextView
      android:id="@+id/text_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      text="Hello World" />

Setting text in Activity/Fragment

Alternately, you can also set the text in your Activity/Fragment.

val textView: AntialiasingTextView = findViewById(R.id.text_view)
textView.text = "Hello World"

Last updated

Copyright © 2023 Leia Inc. All Rights Reserved