Write Multiline Text on Button in Android

Sun picture Sun · Oct 31, 2013 · Viewed 17.5k times · Source

I want to know, How to write Multiline Text on Button

 <Button
    android:id="@+id/button1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="100dp"
    android:background="@drawable/layout_border"
    android:text="Hours   Mon - sat 5pm" />

I am getting like this:-

enter image description here

but required this kind of button:-

enter image description here

Edited::--

Now i got something like this, by using answer given by, @Sino K D :

enter image description here

but still looking for help,

After adding drawable to left side, getting this:-

enter image description here

Answer

Sino picture Sino · Oct 31, 2013

Use &#10;

(new line)

example:-

android:text="Hi&#10;Hello"

OR

1) Define in ../res/values/strings.xml:

 <string name="multilines">Line1Line1\nLine2Line2</string>

2) Refer it in the layout file:

 <Button
   android:id="@+id/btn_multilines"
   android:text="@string/multilines"
   android:layout_height="wrap_content"
   android:layout_width="fill_parent">
</Button>