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
  • 652
  • 11
  • 19
kalai vani
  • 279
  • 2
  • 4
  • 19

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
  • 669
  • 8
  • 30
4

You just need to add this code

 android:justificationMode="inter_word"
Nafeez Quraishi
  • 4,420
  • 2
  • 24
  • 30