Please have a look at the screenshot above, the string for the text is "DELETE SELECTED\nMESSAGES" if I use wrap_content for width/height of its parent linearlayout, the text would look like:
DELETE
SELECTED
MESSAGES
(without line space between each word)
if I use match-parent for the button's width, it will be stretched to match its parent, which is not what I want. Can anyone help me with this?
Thanks!
EDIT:
the layout of the button:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_margin="5dip"
android:paddingTop="5dip"
a开发者_开发知识库ndroid:paddingBottom="0dip"
android:background="@drawable/solid_grey_btm_rounded">
<Button
android:text="@string/delete_selected_messages"
android:id="@+id/btn_delete_message"
android:gravity="center"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/button_grey_selector">
</Button>
</LinearLayout>
I am working on Android 2.3.3 API Level 10, I was testing on a Motorola Milestone(the one with real keyboard)
Try to use android:minLines="2"
, this should help.
I solved it my setting the button's layout_width and layout_height to "match_parent" or "fill_parent", also, added margin to make the button not fullfil its parent, added padding to make the text narrower.
精彩评论