How to remove padding around buttons in Android? How to remove padding around buttons in Android? android android

How to remove padding around buttons in Android?


For me the problem turned out to be minHeight and minWidth on some of the Android themes.

On the Button element, add:

<Button android:minHeight="0dp" android:minWidth="0dp" ...

Or in your button's style:

<item name="android:minHeight">0dp</item><item name="android:minWidth">0dp</item>


My solution was set to 0 the insetTop and insetBottom properties.

<android.support.design.button.MaterialButton        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:insetTop="0dp"        android:insetBottom="0dp"        android:text="@string/view_video"        android:textColor="@color/white"/>


That's not padding, it's the shadow around the button in its background drawable. Create your own background and it will disappear.