- corners(圆角)
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners
android:radius="10dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp"
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp" />
</shape>
- solid(填充色)
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#ffff00"/>
</shape>
- gradient(渐变)
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:type=["linear" | "radial" | "sweep"]
android:angle="90"
android:centerX="0.5"
android:centerY="0.5"
android:startColor="#24e9f2"
android:centerColor="#2564ef"
android:endColor="#25f1ef"
android:gradientRadius="5dp"
android:useLevel="false" />
</shape>
- stroke(描边)
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="1dp"
android:color="#ff0000"
android:dashWidth="1dp"
android:dashGap="1dp" />
</shape>
只想要一边的效果
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="-2dp"
android:right="-2dp"
android:bottom="-2dp">
<shape>
<stroke
android:width="1dp"
android:color="#80646F9A"/>
</shape>
</item>
</layer-list>
- padding(内边距)
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
- size(大小)
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<size
android:width="50dp"
android:height="50dp" />
</shape>