android图片绘制

1、基本圆角、边框

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android" >  
  3.       
  4.     <!-- 填充 -->  
  5.     <solid android:color="#ff9d77" /> <!-- 定义填充的颜色值 -->  
  6.       
  7.     <!-- 描边 -->  
  8.     <stroke  
  9.         android:width="2dp"   
  10.         android:color="#fad3cf" /> <!-- 定义描边的宽度和描边的颜色值 -->  
  11.       
  12.     <!-- 圆角 -->  
  13.     <corners  
  14.         android:bottomLeftRadius="5dp"  
  15.         android:bottomRightRadius="5dp"  
  16.         android:topLeftRadius="5dp"  
  17.         android:topRightRadius="5dp" /> <!-- 设置四个角的半径 -->  
  18.       
  19.     <!-- 间隔 -->  
  20.     <padding  
  21.         android:bottom="10dp"  
  22.         android:left="10dp"  
  23.         android:right="10dp"  
  24.         android:top="10dp" /> <!-- 设置各个方向的间隔 -->  
  25.   
  26. </shape>  
2、自由边框 (左上下有描边,右边无描边)
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <!-- 描边左上下边框 -->
    <item>
        <shape>
            <stroke
                android:width="1dp"
                android:color="#FF6600" />
            <!-- 圆角 -->
            <corners
                android:bottomLeftRadius="3dp"
                android:bottomRightRadius="0dp"
                android:topLeftRadius="3dp"
                android:topRightRadius="0dp" />
        </shape>
    </item>


    <!-- 主体背景 -->
    <item 
        android:bottom="2dp"
        android:left="2dp"
        android:top="2dp">
        <shape android:shape="rectangle" >
            <!-- 填充 -->
            <solid android:color="#FFFFFF" />
            <!-- 设置各个方向的间隔 -->
            <padding
                android:bottom="2dp"
                android:left="2dp"
                android:right="2dp"
                android:top="2dp" />
        </shape>
    </item>
</layer-list>




posted @ 2015-10-27 11:27  你好and程序员  阅读(168)  评论(0编辑  收藏  举报