I have used layer list with two items. The first item display the gradient color and second item display the stroke element with corner radius. Here i want to add gradient color to stroke element.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:endColor="#24615A"
android:startColor="#44968C" />
<corners android:radius="20dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<stroke
android:width="5dp"
android:color="#0AA4F1" />
<corners android:radius="20dp" />
</shape>
</item>
</layer-list>
try to add another rectangle shape but adjust the item padding as follow:
<item>
<shape android:shape="rectangle">
<gradient
android:centerColor="#f5e904"
android:endColor="#ed0f12"
android:startColor="#479644" />
<corners android:radius="20dp" />
</shape>
</item>
<item
android:bottom="7dp"
android:left="7dp"
android:right="7dp"
android:top="7dp">
<shape android:shape="rectangle">
<gradient
android:endColor="#24615A"
android:startColor="#44968C" />
<corners android:radius="20dp" />
</shape>
</item>