To use a custom drawable background with the MaterialButton
you can use the android:background
attribute:
<MaterialButton
app:backgroundTint="@null"
android:background="@drawable/bkg_button_gradient"
... />
NOTE: It requires at least the version 1.2.0-alpha06
Currently it is very important to add app:backgroundTint="@null"
to avoid that the custom background doesn’t get tinted by default with the backgroundTint
color.
With lower versions of the Material Components Library you have to use an AppCompatButton
.