2

I was wondering if there is any way to set a gradient background color to a Card from the Material Components. I was reading through the docs, but I couldn't find anything.

Augusto Carmo
  • 4,386
  • 2
  • 28
  • 61

1 Answers1

0

Create an xml below res/drawable and set the background of your cardview to this xml.

 <?xml version="1.0" encoding="utf-8"?>
    <shape android:shape="rectangle"
            xmlns:android="http://schemas.android.com/apk/res/android">
    
        <gradient
                android:startColor="@color/colorPurple"
                android:endColor="@color/colorBlue"
                android:angle="0"/>
    
    </shape>
Ümit Bülbül
  • 512
  • 2
  • 15