0
我有這個RadioGroup中:裏面的圖像突出單選按鈕和
<RadioGroup
android:id="@+id/radioGroupStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/disclosure_button"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
>
<RadioButton
android:id="@+id/radio_de_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/button_sel"
android:button="@null"
android:drawableRight="@drawable/german_flag"
android:state_checked="@color/blue"
/>
<RadioButton
android:id="@+id/radio_en_start"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:button="@null"
android:checked="true"
android:background="@drawable/button_sel"
android:layout_height="wrap_content"
android:drawableRight="@drawable/english_flag"
android:state_checked="@color/blue"/>
<RadioButton
android:id="@+id/radio_tr_start"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:background="@drawable/button_sel"
android:layout_height="wrap_content"
android:button="@null"
android:drawableRight="@drawable/turkish_flag"
android:state_checked="@color/blue"/>
</RadioGroup>
我希望當我點擊一個它被突出顯示。最初的RadioButtons已經消失。我已經與這個選擇嘗試過,但它不工作...
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/blue"
android:state_focused="true"
android:state_pressed="true"/>
<item
android:drawable="@color/blue"
android:state_focused="false"
android:state_pressed="true"/>
<item
android:drawable="@android:color/transparent"
android:state_focused="true"
android:state_pressed="false"/>
<item
android:drawable="@android:color/transparent"
android:state_focused="false"
android:state_pressed="false"/>
</selector>
我能做些什麼,當它被點擊的XML,而不是後面的代碼高亮顯示每個按鈕?
所以我改變了我的xml文件,並刪除了Android:state_checked =「@ color/blue」。當我點擊標誌時仍然沒有彩色背景:/ – Kazoooka
當你寫「原始RadioButtons消失」時,你的意思是什麼? –
this here:android:button =「@ null」 它從單選按鈕中刪除圓形按鈕^^ – Kazoooka