1. 程式人生 > >android中的shape使用之android:angle

android中的shape使用之android:angle

<?xml version="1.0" encoding="utf-8"?>
<selector
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" >
        <shape>
            <!-- 漸變 -->
            <gradient
                android:startcolor="#ff8c00"
                android:endcolor="#ffffff"
                android:type="radial"
                android:gradientradius="50" />
            <!-- 描邊 -->
            <stroke
                android:width="2dp"
                android:color="#dcdcdc"
                android:dashwidth="5dp" 
                android:dashgap="3dp" />
            <!-- 圓角 -->
            <corners
                android:radius="2dp" />
            <padding
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        </shape>
    </item>

    <item android:state_focused="true" >
        <shape>
            <gradient
                android:startcolor="#ffc2b7"
                android:endcolor="#ffc2b7"
                android:angle="270" />
            <stroke
                android:width="2dp"
                android:color="#dcdcdc" />
            <corners
                android:radius="2dp" />
            <padding
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        </shape>
    </item>

    <item>       
        <shape>