android里shape与渐变色学习
2016-04-26 15:22
513 查看
先说下shape
资源文件里主要包括:边角(corners),渐变色(gradrent),大小(size),边距(padding) ,填充(solid),扫边(stoke)
先说下边角
[html] view
plain copy
<corners
android:radius=""
android:topLeftRadius=""
android:topRightRadius=""
android:bottomLeftRadius=""
android:bottomRightRadius="" />
每个值都是整数dp,设置的是边角半径
渐变色
[html] view
plain copy
<gradient
android:angle=""
android:centerColor=""
android:endColor=""
android:startColor=""
/>
第一个表示的是渐变渐变方向,必须是45的整数倍
大小
[html] view
plain copy
<size
android:width=""
android:height="" />
边距
[html] view
plain copy
<padding
android:left=""
android:top=""
android:right=""
android:bottom="" />
填充
[html] view
plain copy
<solid
android:color="color" />
扫边
[html] view
plain copy
<stroke
android:width=""
android:color="color"
android:dashWidth=""
android:dashGap="" />
上面两个表示实线,width表示表示实线宽度,dashwidth表示虚线宽度,dashGap表示之间的间距
对了shape还有
Android:shape=["rectangle" | "oval" | "line" | "ring"]
rectangle表示矩形
shape是用来定义形状的,gradient定义该形状里面为渐变色填充,startColor起始颜色,endColor结束颜色,angle表示方向角度。当angle=0时,渐变色是从左向右。 然后逆时针方向转,当angle=90时为从下往上。
android:shape 配置的是图形的形式,主要包括方形、圆形等,上边代码为方形。gradient节点主要配置起点颜色、终点颜色、中间点的坐标、中间点的颜色、渐变角度(90度为上下渐变,0为左右渐变),padding节点主要配置上下左右边距,corners节点配置四周园角的半径
LinearGradient : 线性渐变
RadialGradient : 环形渐变
SweepGradient : 扫描渐变---围绕一个中心点扫描渐变就像电影里那种雷达扫描
资源文件里主要包括:边角(corners),渐变色(gradrent),大小(size),边距(padding) ,填充(solid),扫边(stoke)
先说下边角
[html] view
plain copy
<corners
android:radius=""
android:topLeftRadius=""
android:topRightRadius=""
android:bottomLeftRadius=""
android:bottomRightRadius="" />
每个值都是整数dp,设置的是边角半径
渐变色
[html] view
plain copy
<gradient
android:angle=""
android:centerColor=""
android:endColor=""
android:startColor=""
/>
第一个表示的是渐变渐变方向,必须是45的整数倍
大小
[html] view
plain copy
<size
android:width=""
android:height="" />
边距
[html] view
plain copy
<padding
android:left=""
android:top=""
android:right=""
android:bottom="" />
填充
[html] view
plain copy
<solid
android:color="color" />
扫边
[html] view
plain copy
<stroke
android:width=""
android:color="color"
android:dashWidth=""
android:dashGap="" />
上面两个表示实线,width表示表示实线宽度,dashwidth表示虚线宽度,dashGap表示之间的间距
对了shape还有
Android:shape=["rectangle" | "oval" | "line" | "ring"]
rectangle表示矩形
shape是用来定义形状的,gradient定义该形状里面为渐变色填充,startColor起始颜色,endColor结束颜色,angle表示方向角度。当angle=0时,渐变色是从左向右。 然后逆时针方向转,当angle=90时为从下往上。
android:shape 配置的是图形的形式,主要包括方形、圆形等,上边代码为方形。gradient节点主要配置起点颜色、终点颜色、中间点的坐标、中间点的颜色、渐变角度(90度为上下渐变,0为左右渐变),padding节点主要配置上下左右边距,corners节点配置四周园角的半径
LinearGradient : 线性渐变
RadialGradient : 环形渐变
SweepGradient : 扫描渐变---围绕一个中心点扫描渐变就像电影里那种雷达扫描
相关文章推荐
- Android源码学习笔记-同步机制
- Android 5.0 新增和改进的API
- 为什么明明安装了这个Android应用,却找不到
- html5 在Android 开发中的应用
- Android 通过xml 自定义图片
- Android开发6.0出现java.lang.UnsatisfiedLinkError...xxx.so has text relocations
- Android中各种坐标详解
- Android 4.4 Kitkat Phone工作流程浅析(一)__概要和学习计划
- (4.3.2.4) %1$s %1$d Android string
- android 经典博客
- 20160426 Android框架资源整理
- android计时器实现
- Android View框架的measure机制
- Android应用开发中自定义ViewGroup视图容器的教程
- (4.1.30.2)android intent 传递list或者对象
- Android Studio 分析内存泄漏
- (4.3.2.3)Android ListView收缩与展开的封装实现
- Android Studio导入项目出现问题总结
- Android Studio中“错误:非法字符 :\65279”解决方案
- (4.3.2.1)Android ListView点击展开收起效果(一)