shape用法知多少
2015-07-31 15:34
190 查看
首先看下效果图:
shape中有以下几个重要属性:
corners —圆角 、gradient —渐变、padding —内容离边界距离、size—大小、solid —填充颜色、
stroke —描边
参考:疯狂android讲义 android shape的使用详解以及常用效果(渐变色、分割线、边框、半透明阴影效果等)
Android设置虚线、圆角、渐变 Android:res之shape制作圆角、虚线、渐变 Android中的Shape使用总结
shape中有以下几个重要属性:
corners —圆角 、gradient —渐变、padding —内容离边界距离、size—大小、solid —填充颜色、
stroke —描边
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape=["rectangle" | "oval" | "line" | "ring"] > --- 默认为rectangle <corners -- shape=“rectangle”时使用, 圆角 android:radius="integer" -- 半径,值越大角越圆 会被下边的属性覆盖,默认为1dp, android:topLeftRadius="integer” --左上角 android:topRightRadius="integer” -- 右上角 android:bottomLeftRadius=“integer” --右下角 android:bottomRightRadius="integer" /> --左下角 <gradient -- 渐变 android:angle=“integer” --渐变角度,必须为45的整数倍 android:centerX="integer" android:centerY="integer" android:centerColor=“integer” --中间点的颜色 android:endColor=“color” --渐变结束的颜色 android:gradientRadius=“integer” --径向渐变的半径 android:startColor=“color” --渐变开始的颜色 android:type=["linear" 线性渐变| “radial” 径向渐变| "sweep"] android:useLevel=["true" | "false"] /> <padding --内间隔 android:left="integer" android:top="integer" android:right="integer" android:bottom="integer" /> <size -- 指定大小,一般用在imageview配合scaleType属性使用。大小一般会适配滴 android:width="integer" android:height="integer" /> <solid -- 填充颜色,可是是十六进制颜色。(比如想设置半透明效果,直接使用十六就只就OK) android:color="color" /> --填充的颜色 <stroke -- 指定边框,border,dashWidth和dashGap有一个为0dp则为 android:width=“integer” --描边的宽度 android:color=“color” --描述的颜色 android:dashWidth="integer" -- 虚线宽度 android:dashGap="integer" /> -- 虚线间隔宽度 </shape>
参考:疯狂android讲义 android shape的使用详解以及常用效果(渐变色、分割线、边框、半透明阴影效果等)
Android设置虚线、圆角、渐变 Android:res之shape制作圆角、虚线、渐变 Android中的Shape使用总结
相关文章推荐
- HDU 5335 - Walk Out (DFS + 贪心)
- ArcGIS Server 扩展-SOE系列(一)
- Android之——模拟实现检测心率变化的应用实例
- 华为 OJ 初级 输入一个int型数据,计算出该int型数据在内存中存储时1的个数。
- JS闭包理解
- linux登陆之后显示bash-3.00$
- ireport 中的$F、$P、$V
- 博文转载
- android sqlite操作(2)
- (转)hashmap hashtable 的区别 Hash table 内部的数据结构
- [Android]attrs.xml的自定义VIEw
- php给图片加文字水印
- 同台服务器目录之间的文件同步
- 图的深度遍历 SDUT 2107
- POJ 1321:棋盘问题
- 模态弹窗口,关闭后显示在载体界面中
- 进程切换
- GCD ios多线程 runloop
- python数据结构与算法——桶排序
- POJ 1321:棋盘问题