2012-03-15 90 views
0

我使用形狀給我的意見(按鈕)圓角和漸變。要在按下,啓用和禁用之間切換,請使用選擇器。選擇器中的每個項目都是具有其他漸變的形狀。現在我想讓所有形狀都具有一些默認樣式,例如所有的形狀都應該具有相同的圓角半徑。形狀風格

選擇:

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
<item android:drawable="@drawable/shape_button_disabled" 
     android:state_enabled="false" /> 
<item android:drawable="@drawable/shape_button_pressed" 
     android:state_pressed="true" /> 
<item android:drawable="@drawable/shape_button_enabled" /></selector> 

形狀:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
    <gradient android:startColor="@color/yellow_50" 
     android:endColor="@color/yellow_25" 
     android:angle="90"/> 
    <corners android:radius="5px"/> 

我如何定義圓角半徑只在一個地方?

回答