Android Shape应用
来源:互联网 发布:微商和淘宝的区别 编辑:程序博客网 时间:2024/05/02 00:52
Android Shape应用
1、Shape的形状有四种
android:shape="rectangle | oval | ring | line" 指定形状<shape android:shape="rectangle" > <solid android:color="#ffff8c00" /></shape><shape android:shape="oval"> <solid android:color="#ffffc800"/></shape<shape android:shape="ring" android:thickness="5dp" android:useLevel="false"> <solid android:color="#ffff8800" /></shape><shape android:shape="line" > <stroke android:width="5dp" android:color="#ffff8c00" /></shape>
2、solid
retangle、oval和ring都适用solid来填充颜色。android:color用来指定颜色。
3、stroke
android:width指定线的宽度。android:color指定线的颜色。
android:dashWidth指定虚线的宽度。
android:dashGap指定虚线的间隔。
<shape android:shape="rectangle" > <solid android:color="#ffff8c00" /> <stroke android:width="2dp" android:color="#ff000000" /></shape><shap android:shape="rectangle" > <stroke android:width="2dp" android:dashWidth="10dp" android:dashGap="5dp" android:color="#ffff8c00" /></shape>
4、corners
android:radius 指定四个角的半径android:topLeftRadius 指定左上角的半径
android:topRightRadius 指定右上角的半径
android:bottomLeftRadius 指定左下角的半径
android:bottomRightRadius 指定右下角的半径
<corners android:radius="10dp" /><corners android:topLeftRadius="10dp" android:topRightRadius="10dp" />
5、gradient
android:startColor 指定开始颜色android:endColor 指定结束颜色
android:type="linear | radius | sweep" 指定颜色渐变的方式
<gradient android:startColor="#ffff8c00" android:endColor="#ffffffff" android:type="linear" /><gradient android:startColor="#ffff8c00" android:endColor="#ffffffff" android:type="radial" android:gradientRadius="60"/><gradient android:startColor="#ffff8c00" android:endColor="#ffffffff" android:type="sweep" />
android:angle指定方向,0代表从左往右,90代表从下到上,180代表从有往左,angle必须是45的倍数
gradient同样可以用于其他形状
6、ring的专用属性
android:innerRadius 指定内环的半径android:innerRadiusRatio 环的宽度比率表示内环的半径,5时为占比0.2
android:thickness 指定环的厚度
android:thicknessRatio 环的宽度比率来表示环的厚度,5时为占比0.2
android:useLevel 为false
<shape android:shape="ring" android:thickness="5dp" android:useLevel="false"/><shape android:shape="ring" android:thickness="10dp" android:innerRadius="20dp" android:useLevel="false"/><shape android:shape="ring" android:thickness="10dp" android:innerRadius="15dp" android:useLevel="false" /><shape android:shape="ring" android:thicknessRatio="5" android:innerRadius="15dp" android:useLevel="false"/>
0 0
- Android Shape应用
- android shape 的应用
- Android shape的应用
- android 自定义Drawable Shape 的应用
- android:shape
- Android Shape
- android shape
- android:shape
- android shape
- android shape
- Android Shape
- android:shape
- Android Shape
- Android Shape
- android shape
- android shape
- android shape
- Android:shape
- 使用CMake编译代码教程之1
- git小分支
- 微信公众号开发入门
- 10. OpenGL--雾
- 设置对话框、static和group的背景色和字体颜色
- Android Shape应用
- StringBuilder常用方法
- shell 语法与C语言对比
- Ubuntu上安装,卸载nginx
- overflow:hidden属性清除浮动效果的理解
- 在MySQL中建立自己的哈希索引(书摘备查)
- JAVA设计模式之抽象工厂模式
- 线性渐变LinearGradient的使用
- mysql索引详解