Reputation: 39
List item
I want to create a button with one image and more than 2 lines of text. Is it possible in XML? (eclipse)
I`m trying with this code:
android:id="@+id/itm1"
android:text="item1"
android:typeface="sans"
android:textSize="20sp"
android:textColor="#ffffff"
android:width="250dip"
android:height="150dp"
android:drawableLeft="@drawable/image1"
android:background="@android:color/transparent"
android:layout_marginLeft="80dp"/>
Upvotes: 3
Views: 7153
Reputation: 1664
It is a little late, but you can also specify number of lines in the Button itself:
<Button
android:id="@+id/start"
android:lines="2">
</Button>
Upvotes: 3
Reputation: 3393
To insert multiple lines in a button, you might use the string.xml to insert the end of line.
1 Create a new variable with the character endOfLine "\n" in the res/values/strings.xml. For example:
<string name="multiplelines">Line1 \n Line2</string>
2 Refer it in the layout file. For example, for a button:
<Button android:id="@+id/start" android:text="@string/multiplelines" android:layout_height="wrap_content" android:layout_width="fill_parent"> </Button>
Source: http://www.jiahaoliuliu.com/2011/10/android-multiple-lines-for-layout.html
Upvotes: 4