corners ----------圆角
gradient ----------渐变
padding ----------内容离边界距离
size ------------大小
solid ----------填充颜色
stroke ----------描边
注意的是corners的属性bottomLeftRadius为右下角、bottomRightRadius为左下角
1 使用shape作为背景不能指定单边圆角的xml的解决方案
- <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
- <!-- 第一层 -->
- <item>
- <shape>
- <solid android:color="#e9361a" />
- <!-- 圆角 -->
- <corners android:radius="4dp" />
- </shape>
- </item>
- <!-- 第二层 -->
- <!-- 距离第一层上边缘4px -->
- <item android:top="4px">
- <shape>
- <!-- 实心填充颜色 -->
- <solid android:color="#e9361a"/>
- </shape>
- </item>
- </layer-list>