I try to understand the default background of Button (android 26).
sdk/platforms/android-26/data/res/drawable/btn_default_material.xml
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item android:drawable="@drawable/btn_default_mtrl_shape" />
</ripple>
references:
sdk/platforms/android-26/data/res/drawable/btn_default_mtrl_shape.xml
:
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="@dimen/button_inset_horizontal_material"
android:insetTop="@dimen/button_inset_vertical_material"
android:insetRight="@dimen/button_inset_horizontal_material"
android:insetBottom="@dimen/button_inset_vertical_material">
<ripple android:color="?attr/colorControlHighlight">
<item>
<shape android:shape="rectangle"
android:tint="@color/btn_colored_background_material">
<corners android:radius="@dimen/control_corner_material" />
<solid android:color="@color/white" />
<padding android:left="@dimen/button_padding_horizontal_material"
android:top="@dimen/button_padding_vertical_material"
android:right="@dimen/button_padding_horizontal_material"
android:bottom="@dimen/button_padding_vertical_material" />
</shape>
</item>
</ripple>
</inset>
I understand the inset. That is the space around the button background image. I don't understand the padding. There is no text in the background image.
To give an approach to think about it: What would happen if you remove the padding
tag?
You may come to the conclusion that nothing would happen (I am not sure, that nothing would happen). But if nothing happens, you have the question what is it useful for? Why did they place it there?