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 从matrix获取处理过的图片的实际宽度
  2. Android 获取屏幕宽度、高度、dpi等信息
  3. Android绘制简单折线图的步骤
  4. android 根据TextView宽度 自动缩小字体大小 以适应其宽度
  5. android 获取屏幕高度和宽度
  6. Android 获取屏幕高宽度,密度,通知栏高度,截图等常用方法
  7. android之4.0控件switch自定义开关滑块、滑块轨道和宽度
  8. android 自定义相机 取矩形内内容 注意事项
  9. android textview 中超出屏幕宽度的字符 省略号显示

随机推荐

  1. android AsyncTask
  2. Android横竖屏切换的解决方法
  3. android获取设备信息
  4. Android实现应用下载并自动安装apk包
  5. Android(安卓)系统自带的发送短信的界面
  6. Android问题集
  7. Android计时器
  8. 小区广播接收流程
  9. Android(安卓)APK 反编译工具
  10. 编写android拨打电话apk应用实例代码