android中xml文件编写各类型shape

shape可以是圆形,矩形
solid 填充
android:color指定填充的颜色

gradient: 渐变
startColor centerColor endColor  起始中间和结束的颜色
angle 渐变角度 必须是45度的整数倍
type  渐变模式 
linear: 线性渐变
 radial :径向渐变,需指定半径

stroke 描边 
width: 宽度
color: 颜色 
dashWidth: 表示一个横线的宽度
dashGap: 表示之间隔开的距离

corners  圆角
radius 角的弧度
android:topLeftRadius="20dp"              设置左上角的半径
android:topRightRadius="20dp"           设置右上角的半径
android:bottomLeftRadius="20dp"      设置右下角的半径
android:bottomRightRadius="20dp"    设置左下角的半径

padding: 间隔


以下是一个没有左右边框的矩形,带边线.
   
   
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  3. <item>
  4. <shape>
  5. <solid android:color="@color/white" />
  6. </shape>
  7. </item>
  8. <item
  9. android:bottom="1dip"
  10. android:top="1dip">
  11. <shape>
  12. <solid android:color="@color/white" />
  13. </shape>
  14. </item>
  15. </layer-list>

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值