我該如何修改.xml和.java文件,以便RadioButton在選中時顯示一個圖像,而在未選中時顯示另一個圖像?RadioButton Image
舉例單選按鈕我從學習:http://www.androidpeople.com/android-radiobutton-example/
我該如何修改.xml和.java文件,以便RadioButton在選中時顯示一個圖像,而在未選中時顯示另一個圖像?RadioButton Image
舉例單選按鈕我從學習:http://www.androidpeople.com/android-radiobutton-example/
Here是使用StateListDrawable和單選按鈕,並似乎做你想做的一個例子。
您需要將其android:button
屬性設置爲StateListDrawable,該屬性至少有兩個狀態:selected = true和默認值(未選中)。