删除边界和按钮边框之间的空间 [英] Remove space between bounds and button border

本文介绍了删除边界和按钮边框之间的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除Button边框和视图边界之间的空间,尝试将padding设置为0dp,但没有结果.
这些是具有默认样式的材质按钮.

How do I remove those space between Button border and view bounds tried setting padding to 0dp but with no results.
These is material button with default style.

推荐答案

MaterialButton具有带有以下插图的默认样式:

The MaterialButton has a default style with these insets:

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

这篇关于删除边界和按钮边框之间的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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