Remove text padding in Button view

落爺英雄遲暮 提交于 2019-12-01 02:53:51
user2496783

Button text doesn't need padding, it is by default in center of the button. I think you are using the android:theme="@android:style/Theme.Black.NoTitleBar" in the manifest file, please remove it and use native app Theme and try it.

Its not actually padding but the theme is setting a minHeight and minWidth for button widgets. You can completely remove this effect without changing your theme by setting the following on your button in the xml:

android:minHeight="0dp"
android:minWidth="0dp"

It thus also implies that you can play around with different settings for different effects, 0dp is merely an example to completely remove this effect.

you can try using android:includeFontPadding. set it to false. also set the padding to 0.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!