0

I'm trying to add a gradient background to a Material Button, using this drawable:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    >

    <gradient
        android:angle="45"
        android:endColor="#000000"
        android:startColor="#FFFFFF"
        />

</shape>

I'm trying it setting up the background like:

android:background="@drawable/gradient"

But it just doesn't work. I know to setup a solid color I can do it like:

app:backgroundTint="@color/solid"

Any ideas?

xatok
  • 905
  • 5
  • 20
  • Have you had a look at [Add Gradient](https://stackoverflow.com/questions/52371234/how-to-set-a-gradient-background-to-a-material-button) OR [How to set..](https://stackoverflow.com/questions/52908045/how-to-set-a-gradient-background-in-a-material-button-from-material-components) – Barns Feb 27 '20 at 18:56
  • can you share your button's XML? – Deepak Vajpayee Feb 27 '20 at 19:26
  • At the end I will just not user MaterialButton, doesn't seem to support gradients as background – xatok Feb 27 '20 at 21:05

0 Answers0