Android 看到什么写什么——android shape的使用
来源:互联网 发布:npm 淘宝镜像 sass 编辑:程序博客网 时间:2024/04/29 23:43
做代码的搬运工
原地址:http://www.cnblogs.com/cyanfei/archive/2012/07/27/2612023.html
一个带demo的地址:http://blog.csdn.net/lan410812571/article/details/9946991
shape用于设定形状,可以在selector,layout等里面使用,有6个子标签,各属性如下:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 圆角 --> <corners android:radius="9dp" android:topLeftRadius="2dp" android:topRightRadius="2dp" android:bottomLeftRadius="2dp" android:bottomRightRadius="2dp"/><!-- 设置圆角半径 --> <!-- 渐变 --> <gradient android:startColor="@android:color/white" android:centerColor="@android:color/black" android:endColor="@android:color/black" android:useLevel="true" android:angle="45" android:type="radial" android:centerX="0" android:centerY="0" android:gradientRadius="90"/> <!-- 间隔 --> <padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp"/><!-- 各方向的间隔 --> <!-- 大小 --> <size android:width="50dp" android:height="50dp"/><!-- 宽度和高度 --> <!-- 填充 --> <solid android:color="@android:color/white"/><!-- 填充的颜色 --> <!-- 描边 --> <stroke android:width="2dp" android:color="@android:color/black" android:dashWidth="1dp" android:dashGap="2dp"/> </shape>
填充:设置填充的颜色
间隔:设置四个方向上的间隔
大小:设置大小
圆角:同时设置五个属性,则Radius属性无效
android:Radius="20dp" 设置四个角的半径
android:topLeftRadius="20dp" 设置左上角的半径
android:topRightRadius="20dp" 设置右上角的半径
android:bottomLeftRadius="20dp" 设置右下角的半径
android:bottomRightRadius="20dp" 设置左下角的半径
描边:dashWidth和dashGap属性,只要其中一个设置为0dp,则边框为实现边框
android:width="20dp" 设置边边的宽度
android:color="@android:color/black" 设置边边的颜色
android:dashWidth="2dp" 设置虚线的宽度
android:dashGap="20dp" 设置虚线的间隔宽度
渐变:当设置填充颜色后,无渐变效果。angle的值必须是45的倍数(包括0),仅在type="linear"有效,不然会报错。android:useLevel 这个属性不知道有什么用。
angle对应值的起点如图:
- Android 看到什么写什么——android shape的使用
- Android 看到什么写什么——ECTranslation
- Android 看到什么写什么——RollPagerView
- Android 看到什么写什么——关于有时候Android studio编写的时候大R丢失并且import出不来的问题
- Android中的Shape使用,了解一下Shape下面有哪些标签,都代表什么意思?
- 零散知识点总结,看到什么写什么
- C#语句大杂烩 看到什么写什么
- Android布局——shape的使用
- Android实战—Shape 使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- android:shape的使用
- 尝试一下能不能发表,刚刚搜狗浏览器不行
- Spring+RabbitMq简单例子
- Android EditText不弹出软键盘
- PyQt5教程-17-单行文本框
- oracle的权限管理
- Android 看到什么写什么——android shape的使用
- 让用VS2012/VS2013编写的程序在XP中顺利运行
- jsf大将之ajax
- POJ 25456 Aggressive cows 【二分最大化最小值】
- 关于spring+hibernate连接池连接数不够用的解决方案
- oracle数据库中,字段类型不一致,导致查询慢
- js中的异常处理
- 简单搭建alsa编译环境
- C#入门5.1——分支语句之if语句