Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get rid of bottom padding on button

Tags:

android

I have a button. It seems to have bottom padding I cannot get rid of:

<Button
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="Foo"/>

In the resource editor, I can click the button, and you see the padding below the bottom edge of the button there. This seems to block me from properly centering the button vertically in a parent RelativeLayout.

enter image description here

I tried setting padding=0dip and layout_margin=0dip, no effect. That bottom padding persists.

Thanks

like image 842
user291701 Avatar asked Mar 06 '11 16:03

user291701


2 Answers

The padding is in the 9-patch of the buttons themselves.

I'd advise against trying to compensate because these graphics resources can change without notice. You'd be better off building your own 9-patch or editing the existing one to remove the padding.

like image 59
Matthew Willis Avatar answered Oct 11 '22 17:10

Matthew Willis


setting android:layout_marginBottom="-5dp" for the button worked nicely for me.

like image 33
Archimedes Avatar answered Oct 11 '22 16:10

Archimedes