Pages

Monday, July 23, 2012

How to set line spacing in a textview in android?

This is really simple in android. TextViews has a property called “lineSpacingExtra” which you can change to set the line spacing.
?
1
2
3
4
5
6
7
8
9
10
11
12
13
   <TextView 
           android:text="Data" 
           android:id="@+id/textview" 
           android:layout_gravity="top"
           android:gravity="left"
           android:layout_width="fill_parent" 
           android:layout_height="wrap_content"
           android:layout_centerVertical="true"
           android:layout_margin="5dp"
           android:padding="5dp"
           android:textSize="20sp"
           android:lineSpacingExtra="10dp">
          </TextView>
OR

you can call
textView.setLineSpacing()
in the java code itself.

No comments:

Post a Comment

Popular Posts