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

更多相关文章

  1. android下载的进度条
  2. Android中imageView图片放大缩小及旋转功能示例代码
  3. android app启动动画的实现
  4. android 从matrix获取处理过的图片的实际宽度
  5. Android(安卓)获取屏幕高宽度,密度,通知栏高度,截图等常用方法
  6. Android(安卓)获取屏幕宽度、高度、dpi等信息
  7. Android(安卓)利用Sharp样式设置文本框EditText圆角形状
  8. android和j2me之清屏(clearScreen)
  9. android和j2me之清屏(clearScreen)

随机推荐

  1. 那些年,我们一起踩过的 “Android(安卓)坑
  2. 在Android应用中使用百度地图api
  3. Android通过手势实现翻页效果
  4. Android(安卓)手机卫士--参照文档编写选
  5. [RK3399][Android7.1] 调试笔记 --- JNI
  6. Android(安卓)ApiDemos示例解析(144):Vie
  7. [置顶] Android学习之ION memory manager
  8. Android(安卓)FileUtil(android文件工具
  9. 编译Android(安卓)4.0 ICS,报错couldn't l
  10. android浏览器研究-回退和前进