How to change letter spacing in a Textview?
check out android:textScaleX
Depending on how much spacing you need, this might help. That's the only thing remotely related to letter-spacing in the TextView.
Edit: please see @JerabekJakub's response below for an updated, better method to do this starting with api 21 (Lollipop)
Letter Spacing on EditText is not working
letterSpacing
need to be a float value. Try android:letterSpacing="0.50"
Like @mike points out Android Studio does render letter spacing in preview since V4.0
Old Answer
Android Studio doesn't render the letter spacing in the preview, so you will have to manual run it on a device to view the changes.
Textview letter spacing issue
You're using wrap_content
so the size is change according to the text. Simply use fixed dimension
<TextView
android:id="@+id/txt_letter"
android:layout_width="20dp" // fixed size
android:layout_height="20dp" // fixed size
android:background="@drawable/drawable_bg"
android:fontFamily="@font/viga"
android:padding="@dimen/padding_16dp"
android:text="A"
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
How to adjust text kerning in Android TextView?
AFAIK, you cannot adjust kerning in TextView
. You may be able to adjust kerning if you draw the text on the Canvas
yourself using the 2D graphics APIs.
Change text kerning or spacing in TextView?
The solution I found is to mix the solutions 1 and 2 that you described. Adding spaces between letters and than changing the TextScaleX only of the spaces, so you keep other characters the same. I built a custom class that extends TextView
and allows you to define the letter spacing. Everything else is automatic =)
I posted the class on this other answer
Hope that helps ^^
Related Topics
How to Call One Android Application from Another Android Application
Cannot Call Getsupportfragmentmanager() from Activity
Android SQLite Selection Args[] with Int Values
How to Create Custom Shape Button with Selector in Android
Elevation on Android Lollipop Not Working
Handle a View Visibility Change Without Overriding the View
How to Setup Appium in Ubuntu for Android
How to Set Delay in Android Onclick Function
How to Restrict Content Provider Data Across Applications
Android Support Multidex Library Implementation
Realm with Pre Populated Data into Assets
Gradle 0.9.+/0.9.2 Error: Unable to Load Class 'Com.Android.Builder.Testing.Api.Deviceprovider'
Broadcast Receiver Not Working in Ics If the App Is Not Started Atleast Once
Lame Mp3 Encoder Compile for Android
Android - Google Play Like Tabs