Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material Button background gradient

Is there a way i could set a gradient color to a MaterialButton from the google material library. app:backgroundTint only sets color but not gradient color

like image 985
Melvin Kent Avatar asked Jul 27 '18 16:07

Melvin Kent


1 Answers

MaterialButton ignored android:background until release 1.2.0-alpha06.

With this release you can use something like:

<Button
    android:background="@drawable/bg_button_gradient"
    app:backgroundTint="@null"
    ... />

If you require this functionality with earlier versions of the library you can use the AppCompatButton. Something like:

<androidx.appcompat.widget.AppCompatButton
    android:background="@drawable/bg_button_gradient"
like image 94
Gabriele Mariotti Avatar answered Oct 31 '22 17:10

Gabriele Mariotti