Code example for PathShape

0
        path.lineTo(0, 50);
        path.lineTo(50, 100);
        path.lineTo(100, 50);
        path.close();//路径结束
    	ShapeDrawable dr = new ShapeDrawable(
    			new PathShape(path, 100, 100)
    			); 
    	dr.getPaint().setColor(color);
    	return dr;
    } 
	 
	/** 
     * 线性渐变 
     *  
<shape xmlns:android="http://schemas.android.com/apk/res/android"  
    android:shape="rectangle"> 
    <gradient  
        android:type="linear" 
        android:startColor="#FFFF0000"  
        android:centerColor="#FF00FF00"