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

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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值