Android shape drawable

Shape Drawable :

  An XML file that defines a geometric shape.Including colors and gradients. Creats a ShapeDrawable.

1.以shape为根元素需要两个元素:xmlns:android="http://schemas.android.com/apk/res/android" (必要)和 形状(rectangle,oval,line,ring)

子元素包括:

<corners>

  1. android:radius="integer"  
  2. android:topLeftRadius="integer"  
  3. android:topRightRadius="integer"  
  4. android:bottomLeftRadius="integer"  
  5. android:bottomRightRadius="integer"  
<gradient>
  1. android:angle="integer"    设置渐变的角度,数值必须为45的倍数,默认为0,即从左到右渐变。当值为90时,从下到上渐变,以此类推当值为180时  
  2. 为270时从上向下渐变。  
  3. android:centerX="integer"   渐变的水平中心点,值为0-1.0  
  4. android:centerY="integer"   渐变的垂直中心点,值为0-1.0  
  5. android:centerColor="integer"   中心的颜色,非必须  
  6. android:endColor="color"    结束渐变时的颜色  
  7. android:gradientRadius="integer"   渐变的半径,仅适用于android:type="radial"时  
  8. android:startColor="color"  开始渐变时的颜色  
  9. android:type=["linear" | "radial" | "sweep"]   渐变的类型,分别为线状、中心放射状、经测试类似于雷达扫描的一种形态(词汇匮乏不知道该怎么翻译,⊙﹏⊙b汗)  
  10. android:usesLevel=["true" | "false"]   貌似是可以被当做level-list用的意思  
<padding>
 是为内容或子标签设置边距

<size>
设置背景大小,width和height俩属性

<solid>
设置颜色,如果设置了gradient则这项无效

<stroke>
描边
android:width="integer"
android:color="color"
android:dashwidth="integer" and android:dashgap="integer" 当是虚线时使用。一个是虚线的长度,一个是虚线的间距

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值