这是我的代码:
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="nice"
android:paddingVertical="0dp"
android:textColor="@color/light_grey"
app:strokeWidth="2dp"
app:strokeColor="@color/light_grey"
app:cornerRadius="10dp"
android:backgroundTint="@color/white"/>
这是按钮。
按钮图像它有一个垂直的空间,显然不是填充,使按钮小于40dp。我不想通过增加按钮的高度来解决这个问题。
你可以设置Insets属性,所以在你的按钮中添加:
android:insetTop="0dp"
android:insetBottom="0dp"
如果你需要的话,还有insetLeft
和insetRight