菜菜鸟-Android学习笔记02-shaper的使用

来源:互联网 发布:淘宝类目在线查询 编辑:程序博客网 时间:2024/05/07 06:50

Shape的属性:

<shape> Android:shape=["rectangle" | "oval" | "line" | "ring"]
其中rectagle矩形,oval椭圆,line水平直线,ring环形
<shape>中子节点的常用属性:
<gradient> 渐变
Android:startColor
起始颜色
Android:endColor
结束颜色
Android:angle
渐变角度,0从左到右,90表示从下到上,数值为45的整数倍,默认为0;
Android:type
渐变的样式 liner线性渐变 radial环形渐变 sweep
<solid > 填充
Android:color
填充的颜色
<stroke >描边
Android:width
描边的宽度
Android:color
描边的颜色
Android:dashWidth
表示'-'横线的宽度
Android:dashGap
表示'-'横线之间的距离
<corners >圆角
Android:radius
圆角的半径 值越大角越圆
Android:topRightRadius
右上圆角半径
Android:bottomLeftRadius
右下圆角角半径
Android:topLeftRadius
左上圆角半径
Android:bottomRightRadius
左下圆角半径
<padding >填充
android:bottom="1.0dip"
底部填充
android:left="1.0dip"
左边填充
android:right="1.0dip"
右边填充
android:top="0.0dip"
上面填充



使用例子:

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"    android:shape="oval">    <solid        android:color="#000000"        >    </solid>    <gradient        android:startColor="#FF00FF00"        android:endColor="#FF0000FF"        android:type="linear">    </gradient>    <stroke        android:width="1dp"        android:color="#FFFF0088"        android:dashWidth="5dp">    </stroke>    <corners        android:radius="2dp"></corners>    <padding        android:bottom="10dp"        android:top="10dp"></padding></shape>

0 0
原创粉丝点击