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