上不了按钮摆脱底部填充 [英] Can't get rid of bottom padding on button

查看:116
本文介绍了上不了按钮摆脱底部填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按钮。它似乎有底部填充我无法摆脱的:

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"/>

在资源编辑器,我可以按一下按钮,你可以看到有按钮的底部边缘下方的填充。这似乎不能正确居中的按钮垂直在父RelativeLayout的阻止我。

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.

我尝试设置填充= 0dip和layout_margin = 0dip,没有效果。这种底部填充仍然存在。

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

感谢

推荐答案

的填充是在9补丁按钮本身的。

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

我建议不要试图弥补因为这些图形资源可以更改,恕不另行通知。你会更好构建自己的9补丁或编辑现有删除填充。

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.

这篇关于上不了按钮摆脱底部填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆