Android Autosizing TextView edit

Granularity

In Java:

Call the setAutoSizeTextTypeUniformWithConfiguration() method:

setAutoSizeTextTypeUniformWithConfiguration(int autoSizeMinTextSize, int autoSizeMaxTextSize, int autoSizeStepGranularity, int unit)

In XML:

Use the autoSizeMinTextSize, autoSizeMaxTextSize, and autoSizeStepGranularity attributes to set the auto-sizing dimensions in the layout XML file:

<TextView android:id=”@+id/autosizing_textview_presetsize” 
        android:layout_width=”wrap_content” 
        android:layout_height=”250dp” 
        android:layout_marginLeft=”0dp” 
        android:layout_marginTop=”0dp” 
        android:autoSizeMaxTextSize=”100sp” 
        android:autoSizeMinTextSize=”12sp” 
        android:autoSizeStepGranularity=”2sp” 
        android:autoSizeText=”uniform” 
        android:text=”Hello World!” 
        android:textSize=”100sp” 
        app:layout_constraintLeft_toLeftOf=”parent” 
        app:layout_constraintTop_toTopOf=”parent” />

Check out the AutosizingTextViews-Demo at GitHub for more details.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Table Of Contents
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
233 Autosizing TextView
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close