shap在drawable目录下,根节点为shap。
1.圆形或者椭圆形
android:shape="oval"? 椭圆
solid 颜色
控件长宽相等时显示圆,不相等时椭圆
? ? android:shape="oval" >? ?
? ?
使用时与drawable下的资源方式相同
? ? ? ? android:id="@+id/textview1"
? ? ? ? android:layout_width="30dp"
? ? ? ? android:layout_height="30dp"
? ? ? ? android:background="@drawable/textview_bg" />

2.圆角矩形
android:shape="rectangle" 矩形
corners 半径,可以分别对四个角设半径
? ? android:shape="rectangle" >
? ? ? ? ? ? android:bottomLeftRadius="10dip"
? ? ? ? android:bottomRightRadius="10dip"
? ? ? ? android:topLeftRadius="10dip"
? ? ? ? android:topRightRadius="10dip" />
? ?

3.渐变
gradient渐变
startColor 起始颜色
endColor 结束颜色
angle 渐变角度
padding 与控件边缘的距离
? ? android:shape="rectangle">
? ? ? ? ? ? android:startColor="#FFFF0000"
? ? ? ? android:endColor="#80FF00FF"
? ? ? ? android:angle="45"/>
? ? ? ? ? ? android:top="7dp"
? ? ? ? android:right="7dp"
? ? ? ? android:bottom="7dp" />
? ?

4.边框效果
stroke 边框,可以设置颜色和宽度
? ? android:shape="rectangle" >
? ? ? ? ? ? android:bottomLeftRadius="10dip"
? ? ? ? android:bottomRightRadius="10dip"
? ? ? ? android:topLeftRadius="10dip"
? ? ? ? android:topRightRadius="10dip" />
? ?
? ? ? ? ? ? android:color="@android:color/white"/>

5.圆环效果
就是shape="oval" 椭圆? 加上? stroke边框
? ? android:shape="oval" >
? ? ? ? ? ? android:bottomLeftRadius="10dip"
? ? ? ? android:bottomRightRadius="10dip"
? ? ? ? android:topLeftRadius="10dip"
? ? ? ? android:topRightRadius="10dip" />
? ?
? ? ? ? ? ? android:color="@android:color/white"/>
