从上到下绘制如图所示
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="#20a7ea"
android:startColor="#4adcf9" />
</shape>
从左到右绘制渐变色如图所示
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:startColor="#F8CE64" android:endColor="#FCAD79"/>
<corners android:radius="24dp" /> <corners
android:bottomLeftRadius="20dip"
android:bottomRightRadius="20dip"
android:topLeftRadius="0dip"
android:topRightRadius="0dip" /> </shape>