代码中说明:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 设置不同的形状 -->
<!-- 矩形 android:shape="rectangle" -->
<!-- 椭圆 android:shape="oval" -->
<!-- 直线android:shape="line" -->
<!-- 圆 android:shape="ring" -->
<!-- 分别设置4个脚的圆角 -->
<!-- android:topLeftRadius="3dp" -->
<!-- android:topRightRadius="3dp" -->
<!-- android:bottomLeftRadius="3dp" -->
<!-- android:bottomRightRadius="3dp" -->
<!-- 统一设置圆角 -->
<corners android:radius="3dp" />
<!-- 渐变色 -->
<gradient
//开始颜色
android:startColor="#f00"
//中间颜色
android:centerColor="#0f0"
//结束颜色
android:endColor="#00f"
/>
<!-- 边框宽度及颜色 -->
<!-- 描边, 空的距离android:dashGap="5dp" -->
<!-- 虚线宽android:dashWidth="13dp" -->
<stroke
//边框的宽度
android:width="1dp"
//颜色
android:color="#66000000" />
<!-- 间距 -->
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
<!-- 宽高,需把android:layout_width和layout_height设置为自适应 才生效 -->
<size
android:height="55sp"
android:width="120sp" />
<!-- 填充颜色 与gradient设置的属性有冲突 -->
<!-- 编辑框的背景颜色 -->
<solid android:color="#FFFFFF" >
</solid>
</shape>