shape标签总结

android开发中经常用到shape,有些标签总是忘记,所以今天就写下来。

shape标签的总结:

1.solid:里面只有一个属性,color属性。所以solid是作用就是对设置shape的控件的颜色背景。

2.gradient:这个标签用的不多,但是也有用的时候。

gradient属性有: 

android:startColor=""
        android:centerColor=""
        android:endColor=""
        android:useLevel=""
        android:angle=""
        android:type=""
        android:centerX=""
        android:centerY=""
        android:gradientRadius=""

其中android:startColor是指渐变刚开始显示的颜色,

android:centerColor是渐变中间颜色,

android:endColor是渐变结束时的颜色,

android:useLevel的值只有boolean值,true和false,就是是否使用LevelListDrawable中的Drawable资源,如果是true就是使用Drawable资源,如果false就不使用drawable资源。

android:angle是渐变的方向,常用的值有0,90,180,270.其中0和180方向相反,0是从左向右,180则是从右向左;而270和90也是方向相反的,270是从上向下;

android:type是渐变的类型,有线性渐变(linear),放射性渐变(radial),扫描渐变(sweep);

android:centerX和android:centerY都是渐变中心的坐标,其中x是渐变中心的x坐标,y是渐变中心的y坐标。

android:gradientRadius直接翻译过来的意思是“渐变半径”,也确实是渐变半径,不过是要在渐变有半径时才能使用,也就是渐变类型是放射性渐变时才能使用,否则不行。

3.stroke是设置设置shape的控件的边标签,的其中的属性有:

        android:width=""
        android:color=""
        android:dashWidth=""
        android:dashGap=""其中android:width是指边的宽度,android:color颜色;android:dashWidth是设置边的线为虚线时一个虚线的宽度(左右宽度),android:dashWidth是指虚线与虚线之间的间隔。

4.corners是设置控件四个角的半径的,它的属性有:

android:bottomLeftRadius=""
        android:bottomRightRadius=""
        android:radius=""
        android:topLeftRadius=""
        android:topRightRadius=""

见名知意不做多介绍。

5.padding:是设置内容据边框的距离:

其中的属性有:

android:bottom=""
        android:left=""
        android:right=""
        android:top=""

见名知意不做多介绍。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值