Shape的参数

来源:互联网 发布:知乎 追一个很喜欢的人 编辑:程序博客网 时间:2024/06/03 17:45
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"    android:shape="ring"> <!-- rectangle | line | oval | ring  默认为rectangle-->    <!-- dang shape="rectangle"时候使用半径,会被后面的单个半径属性覆盖 默认1dp-->    <corners        android:bottomLeftRadius="integer"        android:bottomRightRadius="integer"        android:radius="integer"        android:topLeftRadius="integer"        android:topRightRadius="integer" />    <gradient        android:angle="integer"        android:centerColor="integer"        android:centerX="integer"        android:centerY="integer"        android:endColor="color"        android:gradientRadius="integer"        android:startColor="color"        android:type="linear"        android:useLevel="false" />    <padding        android:bottom="integer"        android:left="integer"        android:right="integer"        android:top="integer" />    <!--指定大小,一般用在imageview配合scaleType属性使用-->    <size        android:width="integer"        android:height="integer" />    <!-- 填充颜色-->    <solid android:color="color" />    <stroke        android:width="integer"        android:color="color"        android:dashGap="integer"        android:dashWidth="integer" />  <!--  虚线宽度    虚线间的宽度--></shape>

来个实例

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle"> <!-- rectangle | line | oval | ring  默认为rectangle--><!-- dang shape="rectangle"时候使用半径,会被后面的单个半径属性覆盖 默认1dp--><gradient    android:angle="45"    android:endColor="#805FBBFF"    android:startColor="#FF5DA2FF" /><padding    android:bottom="7dp"    android:left="7dp"    android:right="7dp"    android:top="7dp" /><corners android:radius="8dp" /></shape>


0 0
原创粉丝点击