Android(安卓)Shape 的使用入门
16lz
2021-12-12
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下载的进度条
- Android中imageView图片放大缩小及旋转功能示例代码
- android app启动动画的实现
- android 从matrix获取处理过的图片的实际宽度
- Android(安卓)获取屏幕高宽度,密度,通知栏高度,截图等常用方法
- Android(安卓)获取屏幕宽度、高度、dpi等信息
- Android(安卓)利用Sharp样式设置文本框EditText圆角形状
- android和j2me之清屏(clearScreen)
- android和j2me之清屏(clearScreen)