通过android:shape属性指定形状:rectangle,oval(椭圆),line,ring;
solid : 设置形状填充的颜色,只有android:color一个属性;gradient : 设置形状的渐变颜色,可以是线性渐变、辐射渐变、扫描性渐变;
android:type 渐变的类型
linear 线性渐变,默认的渐变类型
radial 放射渐变,设置该项时,android:gradientRadius也必须设置
sweep 扫描性渐变
android:startColor 渐变开始的颜色
android:endColor 渐变结束的颜色
android:centerColor 渐变中间的颜色
android:angle 渐变的角度,线性渐变时才有效,必须是
45
的倍数,
0
表示从左到右,
90
表示从下到上
android:centerX 渐变中心的相对X坐标,放射渐变时才有效,在
0.0
到
1.0
之间,默认为
0.5
,表示在正中间
android:centerY 渐变中心的相对X坐标,放射渐变时才有效,在
0.0
到
1.0
之间,默认为
0.5
,表示在正中间
android:gradientRadius 渐变的半径,只有渐变类型为radial时才使用
android:useLevel 如果为
true
,则可在LevelListDrawable中使用
corners : 设置圆角,只适用于rectangle类型
android:radius 圆角半径,会被下面每个特定的圆角属性重写
android:topLeftRadius 左上角的半径
android:topRightRadius 右上角的半径
android:bottomLeftRadius 左下角的半径
stroke : 设置描边,可描成实线或虚线
android:color 描边的颜色
android:width 描边的宽度
android:dashWidth 设置虚线时的横线长度