2

I have one TextView in xml, but am giving the TextView values in java.while displaying its not proper alignment.Please can you give solution.

In Xml i give the values means it's displaying properly,but in java i am giving values its not showing in proper way.I want to justify the text

    <TextView 
    android:text="" android:id="@+id/result"
    android:layout_marginTop="13dp"
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="left|center|right" 
    android:gravity="left|center|right" 
    android:textStyle="bold" 
    android:textAlignment="center" 
    android:layout_marginRight="5dp" 
    android:layout_marginLeft="5dp"
    android:textSize="15dp" />
yatin deokar
  • 730
  • 11
  • 20
kalai vani
  • 289
  • 2
  • 4
  • 21

2 Answers2

5

Android 0 supports justification of TextView. Please follow the below link

You can also use below library for Text Justfication.

Hope it helps

Abdul Aleem
  • 679
  • 8
  • 31
5

You just need to add this code

 android:justificationMode="inter_word"
Nafeez Quraishi
  • 5,380
  • 2
  • 27
  • 34