3
我正在嘗試使ImageButton處於按下,聚焦和正常狀態。 我讀過ImageButton的介紹hereImageButton選擇器不起作用?
我已經將選擇器XML文件保存在/ res/drawable /中。還要設置android:src="@drawable/my_selector"
。
my_selector.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_unfocus" /> <!-- default -->
<item android:state_pressed="true"
android:drawable="@drawable/btn_onpress" /> <!-- pressed -->
<item android:state_focused="true"
android:drawable="@drawable/btn_onfocus" /> <!-- focused -->
</selector>
我覺得我已經做了正確的ImageButton。但它不適合我。
這裏有什麼問題?
請指教。
kenu.heo有很好的答案,你可以接受它 – AndrewS 2014-01-08 17:47:38