Skip to content Skip to sidebar Skip to footer

Remove Space Between Bounds And Button Border

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.

Solution 1:

The MaterialButton has a default style with these insets:

<stylename="Widget.MaterialComponents.Button"..><itemname="android:insetLeft">0dp</item><itemname="android:insetRight">0dp</item><itemname="android:insetTop">@dimen/mtrl_btn_inset</item><itemname="android:insetBottom">@dimen/mtrl_btn_inset</item>
    ...
 </style>

The value of @dimen/mtrl_btn_inset is 6dp.

Just use:

<com.google.android.material.button.MaterialButtonandroid:insetTop="0dp"android:insetBottom="0dp"../>

enter image description hereenter image description here

Solution 2:

you can use weight and make the width 0dp then space will be removed.

Post a Comment for "Remove Space Between Bounds And Button Border"