Can't get rid of bottom padding on button

后端 未结 4 1989
一生所求
一生所求 2021-01-13 05:15

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

相关标签:
4条回答
  • 2021-01-13 05:39

    I am late to answer this but thought to share if someone come across similar use case( Removing all the inner and outer padding in Button )

    <Button
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="-5dp"
    android:layout_marginLeft="-5dp"
    android:layout_marginRight="-5dp"
    android:layout_marginTop="-5dp"
    android:minHeight="-2dp"
    android:minWidth="-2dp"
    android:text="TextView"
    android:textSize="12sp" />
    
    0 讨论(0)
  • 2021-01-13 05:46

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

    0 讨论(0)
  • 2021-01-13 05:47

    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.

    0 讨论(0)
  • 2021-01-13 05:55

    Hmn really strange. Never noticed that. Probably because u usally want a little space around your buttons.

    Also tried margin/padding=0dp and did in fact not work.

    You could set android:layout_marginBottom="-10dp" however :).

    0 讨论(0)
提交回复
热议问题