读书人

Android button设置height后圆角消失有

发布时间: 2012-06-28 15:20:04 作者: rapoo

Android button设置height后圆角消失问题

<?xml version="1.0" encoding="utf-8"?><selector    xmlns:android="http://schemas.android.com/apk/res/android">    <!-- pressed -->    <item android:state_pressed="true" >        <shape  android:shape="rectangle">            <gradient                android:startColor="#ff8c00"                android:endColor="#ff8c00"                android:angle="270" />                       <corners                android:radius="4dp" />        </shape>    </item>   <!-- focus -->   <item android:state_focused="true" >        <shape>            <gradient                android:startColor="#ffc2b7"                android:endColor="#ffc2b7"                android:angle="270" />                        <corners                android:radius="4dp" />        </shape>    </item>        </selector>然后在button的定义中加上:android:background="@drawable/button_selector_gradient"(button_selector_gradient是上述xml文件的文件名称)

读书人网 >Android

热点推荐