4

When text is small then I get this:

enter image description here

But when text is big I get this:

enter image description here

Is it possible that text adjust itself by maybe better using spaces or decreasing little size automatically?

This is my TextView xml:

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/seaGreen"
            android:gravity="center_vertical"
            android:padding="10dp"
            android:textColor="@color/white"
            android:textSize="35sp" />
Mohd Ali
  • 281
  • 2
  • 13

2 Answers2

1

For that you need to use external library for that, else you can set gravity as center

Library :

https://github.com/grantland/android-autofittextview

For Text Justify

https://github.com/bluejamesbond/TextJustify-Android

https://github.com/programingjd/justified

OR

you can check this answer

Community
  • 1
  • 1
Madhur
  • 3,138
  • 17
  • 27
1
this work for me:    
 <TextView
        android:id="@+id/your_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:textAlignment="center"
        android:gravity="center"
        android:padding="5dp"
        android:text=""
        android:textSize="14sp"/>