Android Shape 的使用入门
16lz
2021-01-23
1. 使用 shape 绘制线条
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"><stroke android:dashGap="3dp" android:dashWidth="2dp" android:width="1dp" android:color="#777777"/><size android:height="2dp"/>shape>
2. 使用 shape 绘制圆形
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"><solid android:color="#F0F0F0">solid><stroke android:width="2dp" android:color="#777777">stroke><corners android:radius="5dp"/>shape>
3. 使用 shape 绘制矩形
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"><solid android:color="#F0F0F0">solid><stroke android:dashGap="2dp" android:dashWidth="5dp" android:width="2dp" android:color="#777777"/><size android:height="10dp"/><corners android:radius="0dp"/>shape>
4. 使用 shape 绘制半圆角矩形
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"><corners android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" android:topLeftRadius="5dp" android:topRightRadius="5dp"/><gradient android:angle="270" android:endColor="#d3d3d3" android:startColor="#d3d3d3"/><stroke android:width="0.5dp" android:color="#d9d9d9"/>shape>
转载自:http://www.cnblogs.com/sunzn/archive/2013/01/22/2871943.html
更多相关文章
- android 从matrix获取处理过的图片的实际宽度
- Android 获取屏幕宽度、高度、dpi等信息
- Android绘制简单折线图的步骤
- android 根据TextView宽度 自动缩小字体大小 以适应其宽度
- android 获取屏幕高度和宽度
- Android 获取屏幕高宽度,密度,通知栏高度,截图等常用方法
- android之4.0控件switch自定义开关滑块、滑块轨道和宽度
- android 自定义相机 取矩形内内容 注意事项
- android textview 中超出屏幕宽度的字符 省略号显示