Android Studio xmls shape properties

xmls shape properties

属性表:

属性属性值描述
shape-------------------
dithertrue/false将在位图的像素配置与屏幕不同是启用为(ARGB8000位图和RGB565屏幕)启用位图抖动,值为false停止
shaperectangle/line/oval/ring分别为矩形,线,椭圆,环默认为rectangle
innerRadiusintegershape为ring时可用,内环半径
innerRadiusRatiofloatshape为ring时可用内环的厚度比,即环的比表示内环半径,默认为3可被innerRadius值覆盖
thicknessintegershape为ring时可用,环的厚度
thicknessRatiofloat环的厚度比即环的宽度比 表示环的厚度,默认为9,可被thickness值覆盖
tintcolor给shape着色
tintModesrc_in / src_atop / stc_over / add / multiply / screen着色类型
visiblefalse / true设置可见性
corners-----------------圆角-----
radiusinteger半径,如果设置该属性则以下几个属性失效
bottomLeftRadiusinteger左下角圆角半径
bottomRightRadiusinteger右下角圆角半径
topLeftRadiusinteger左上角圆角半径
topRightRadiusinteger右上角圆角半径
gradient-----------------渐变-----
useLevenlfalse/true与上面shape的属性是否一致
typelinear / radial / sweep渐变类型,分别为线性,放射性,扫描性渐变默认渐变性
angleinteger渐变角度,当上面type为线性渐变linear时有效。角度为45的倍数
centerColorcolor渐变中间位置的颜色
startColorcolor渐变开始位置的颜色
endColorcolor渐变结束位置的颜色
centerXfloattype为放射性radial时有效,设置渐变中心X的坐标,取值区域为【0,1】默认为0.5
centerYfloattype为放射性radial时有效,设置渐变中心Y的坐标,取值区域为【0,1】默认为0.5
gradientRadiusintegertype为放射性渐变radial时有效,渐变半径
size-------------大小—
widthinteger宽度
heightinteger高度
solid---------------填充------
colorcolorshape填充的颜色
stroke--------------描边-----
colorcolor描边的颜色
widthinteger描边的宽度
dashGapinteger虚线间隔
dashWidthinteger虚线宽度
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="ring"
    android:innerRadius="50dp"
    android:innerRadiusRatio="5"
    android:thickness="120dp"
    android:thicknessRatio="8"
    android:useLevel="false"
    >
    <gradient
        android:type="linear"
        android:useLevel="false"
        android:angle="45"
        android:startColor="@color/colorAccent"
        android:centerColor="@android:color/black"
        android:endColor="@color/colorPrimary"/>
</shape>

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值