当我们想把多个图层叠在一起显示的时候,可以使用layer-list
在/res/drawable/文件夹下建立 test.xml
内容如下:
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <solid android:color="#FFB2B9BE"/> </shape> </item> <item android:bottom="1px"> <shape> <gradient android:startColor="#FFDCE2E6" android:endColor="#FFBAC2C6" android:angle="-90"/> </shape> </item> </layer-list>使用的时候和其他的资源文件的使用方法一样 android:background="@drawable/test"