删除边界和按钮边框之间的 space
Remove space between bounds and button border
如何删除 Button
边框和视图边界之间的那些 space 尝试将 padding
设置为 0dp
但没有结果。
这些是具有默认样式的 material 按钮。
您可以使用权重并将宽度设置为 0dp,然后 space 将被删除。
MaterialButton
具有带有这些插图的默认样式:
<style name="Widget.MaterialComponents.Button"..>
<item name="android:insetLeft">0dp</item>
<item name="android:insetRight">0dp</item>
<item name="android:insetTop">@dimen/mtrl_btn_inset</item>
<item name="android:insetBottom">@dimen/mtrl_btn_inset</item>
...
</style>
@dimen/mtrl_btn_inset
的值为 6dp
。
只需使用:
<com.google.android.material.button.MaterialButton
android:insetTop="0dp"
android:insetBottom="0dp"
../>
如何删除 Button
边框和视图边界之间的那些 space 尝试将 padding
设置为 0dp
但没有结果。
这些是具有默认样式的 material 按钮。
您可以使用权重并将宽度设置为 0dp,然后 space 将被删除。
MaterialButton
具有带有这些插图的默认样式:
<style name="Widget.MaterialComponents.Button"..>
<item name="android:insetLeft">0dp</item>
<item name="android:insetRight">0dp</item>
<item name="android:insetTop">@dimen/mtrl_btn_inset</item>
<item name="android:insetBottom">@dimen/mtrl_btn_inset</item>
...
</style>
@dimen/mtrl_btn_inset
的值为 6dp
。
只需使用:
<com.google.android.material.button.MaterialButton
android:insetTop="0dp"
android:insetBottom="0dp"
../>