Reputation: 3617
When I put a view on a layout, it automatically has some padding/margin on it.
See this picture:
The red rectangle show the space that the button takes. Note the empty space between the button and the red lines. That's the space in question.
What controls that space and how to I change it ?
It's messing up my lisview's button alignments!
The code for that layout:
<Button
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="@+id/Button02"
android:id="@+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
Upvotes: 1
Views: 1845
Reputation: 33983
The button has a default background set by Android. If you look at Android source code, you can find that the button's background has a transparent area around it. This is done in order to make it into a nine-patch drawable. So you cannot remove that padding unless you specify your own background drawable for the button.
Upvotes: 6