1

I have a button in my Android app view, with a layout:width of wrap_content which automatically adjusts the width depending on the button's contents.

I want to apply some left-right padding to the button, so I want to add an extra 10px or so on top of the value of wrap_content.

How can I accomplish this in XML?

4

1 回答 1

3

Have you tried setting the left and right padding?

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
/>
于 2013-07-02T21:00:49.087 回答