shape简单的使用
来源:互联网 发布:孤岛危机3优化补丁 编辑:程序博客网 时间:2024/06/06 21:22
一个菜鸟的学习记录
有时候我们为了节约空间,也为了更加方便 我们会使用shape标签,使用shape标签能处理很多问题,比如圆角的控件、颜色的改变、按钮不同状态显示不同颜色等等。
它的基本属性(corners、gradient、padding、size、solid、stroke)
① corners:用来定义圆角
android:radius="5dp" //设置全部的圆角半径 android:topLeftRadius="5dp" //左上角的圆角半径 android:topRightRadius="5dp" //右上角的圆角半径 android:bottomLeftRadius="5dp" //左下角的圆角半径 android:bottomRightRadius="5dp" //右下角的圆角半径
注意:其中radius和其他四个不能同时使用
②padding和size
貌似size很少用到,一般都是在控件里边设置好的。
padding这个跟其他地方用到的一样就是设置内边距。
③stroke
这个就是设置四条边的属性:
android:width="5dp" //边的宽度 android:height="5dp" //边的高度 android:color="color" //边的颜色 android:dashWidth="10dp" // 把四条边设置成虚线,并设置虚线区域的宽度 android:dashGap="1dp"//设置2条虚线之间的间隔
④solid:填充色,这个就相当于设置背景颜色
<solid android:color="#bbbbbb"/>
⑤gradient:渐变色
首先有三种渐变类型,分别是:linear(线性渐变)、radial(放射性渐变)、sweep(扫描式渐变)
android:type=["linear" | "radial" | "sweep"] //共有3中渐变类型,线性渐变(默认)/放射渐变/扫描式渐变 android:angle="integer" //渐变角度,必须为45的倍数,0为从左到右,90为从上到下 android:centerX="floatx" //渐变中心X的相当位置,范围为0~1 android:centerY="floaty" //渐变中心Y的相当位置,范围为0~1 android:startColor="color" //渐变开始点的颜色 android:centerColor="color" //渐变中间点的颜色,在开始与结束点之间 android:endColor="color" //渐变结束点的颜色 android:gradientRadius="float" //渐变的半径,只有当渐变类型为radial时才能使用 android:useLevel=["true" | "false"] /> //使用LevelListDrawable时就要设置为true。设为false时才有渐变效果
0 0
- Shape 的简单使用
- shape简单的使用
- Shape的简单使用
- shape,selector,layer_list,gradient的简单使用
- Android开发shape的简单使用
- shape 简单使用
- 关于Android中shape标签的简单使用
- Shape的简单使用(常用属性说明)
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- springmvc的controller方法中接受到的参数值为NULL
- NYOJ 109数列转换
- 为什么采用4~20mA的电流来传输模拟量?
- 解决node-sass偶尔安装失败的方法
- 新建虚拟设备时出现target项不可操作
- shape简单的使用
- 常用 Git 命令清单
- SSH框架中applicationContext.xml文件的配置
- C++primer第4版第五章第六章表达式和语句
- 第二章 VHDL语言程序结构
- DatePicker隐藏年月日显示
- andriod sdk tools列表缺少安装文件
- window与linux下的换行
- 无锁(lock-free) 数据结构