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:-
but required this kind of button:-
Edited::--
Now i got something like this, by using answer given by, @Sino K D :
but still looking for help,
After adding drawable to left side, getting this:-
you can achieve using this.
1->create a button in layout as
2-> Add this class in your project.
3-> add these lines in your activity class
For Android layout, multiple lines of text could be added to the elements.
Create a new variable with the character endOfLine "\n" in the res/values/strings.xml.
For example:
Refer it in the layout file. For example,
Use
(new line)
example:-
OR
1) Define in ../res/values/strings.xml:
2) Refer it in the layout file:
Use
(new line)The solution that can be used in strings.xml, the separator is \n within CDATA
you could use a
LinearLayout
instead of a button and achieve a similar effect:This might not work perfect, but it's a start