make gradient color in android code example
Example 1: how to set gradient background in android
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#ff2d9a59" android:endColor="#ff23729a" android:angle="90" /></shape>
Example 2: how to give gradient color to fab in android
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient
android:type="linear"
android:angle="0"
android:startColor="#f6ee19"
android:endColor="#115ede" />
</shape>
</item>
<item android:gravity="center"
>
<bitmap android:src="@drawable/your_icon"
android:gravity="fill_horizontal" />
</item>
</layer-list>