Android Drawable

1. Shape

属性: 

(1) solid ( 填充 )

      参数:android:color ( 填充的颜色 )

(2) gradient ( 渐变 )

      参数:android:startColor ( 开始颜色 ) 、android:endColor ( 结束颜色 )、android:angle ( 渐变角度 )、android:type ( linear adial  线性渐变径向渐变 )

      其渐变模式默认为:android:type="linear",径向渐变需要指定半径android:gradientRadius="50"。

(3) stroke ( 描边 )

      参数:android:width ( 描边的宽度 )、android:color ( 描边的颜色 )、android:dashWidth ( 虚线横线的宽度 )、android:dashGap ( 虚线横线之前的距离 )

(4) corners ( 圆角 )

      参数:android:topRightRadius ( 右上角 )、android:bottomLeftRadius ( 右下角 )、android:topLeftRadius ( 左上角 )、android:bottomRightRadius ( 左下角 )

      android:bottomLeftRadius是右下角,而不是左下角。

(5) padding ( 间隔 )

      参数:android:paddingTop ( 上间隔 )、android:paddingBottom ( 下间隔 )、android:paddingLeft ( 左间隔 )、android:paddingRight ( 右间隔 )

shape画线(水平线):

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <shape
 3    xmlns:android="http://schemas.android.com/apk/res/android"
 4    android:shape="line">
 5 
 6    <!-- 描边 -->
 7    <stroke
 8         android:width="2dip"
 9         android:color="#FFFFFFF" />
10 
11    <size android:height="20dip"/>
12 </shape>
原文地址:https://www.cnblogs.com/CharlesGrant/p/4953155.html