Android中我们一般通过给控件设置png图片来改变控的外观,shap也能定义简单的图形来完成同样的的功能。
shap在drawable目录下,根节点为shap。
1.圆形或者椭圆形
android:shape="oval" 椭圆
solid 颜色
控件长宽相等时显示圆,不相等时椭圆
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >   
<solid android:color="#55000000" />
</shape>
使用时与drawable下的资源方式相同
<TextView
        android:id="@+id/textview1"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:background="@drawable/textview_bg" />

2.圆角矩形 
android:shape="rectangle" 矩形
corners 半径,可以分别对四个角设半径
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
<corners
        android:bottomLeftRadius="10dip"
        android:bottomRightRadius="10dip"
        android:topLeftRadius="10dip"
        android:topRightRadius="10dip" />
<solid android:color="#55000000" />
</shape>

3.渐变
gradient渐变
startColor 起始颜色
endColor 结束颜色
angle 渐变角度
padding 与控件边缘的距离
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#FFFF0000"
        android:endColor="#80FF00FF"
        android:angle="45"/>
    <padding android:left="7dp"
        android:top="7dp"
        android:right="7dp"
        android:bottom="7dp" />
    <corners android:radius="8dp" />
</shape>

4.边框效果
stroke 边框,可以设置颜色和宽度
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
<corners
        android:bottomLeftRadius="10dip"
        android:bottomRightRadius="10dip"
        android:topLeftRadius="10dip"
        android:topRightRadius="10dip" />
<solid android:color="#55000000" />
<stroke android:width="4dip"
        android:color="@android:color/white"/>
</shape>

5.圆环效果
就是shape="oval" 椭圆 加上 stroke边框
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >
<corners
        android:bottomLeftRadius="10dip"
        android:bottomRightRadius="10dip"
        android:topLeftRadius="10dip"
        android:topRightRadius="10dip" />
<solid android:color="#55000000" />
<stroke android:width="4dip"
        android:color="@android:color/white"/>
</shape>

最简单的Ubuntu Touch & Android 双系统安装方式
在Nexus上实现Ubuntu和Android 4.4.2 双启动
Ubuntu 14.04 配置 Android SDK 开发环境
64位Ubuntu 11.10下Android开发环境的搭建(JDK+Eclipse+ADT+Android SDK详细)

