【发布时间】:2012-10-12 19:28:35
【问题描述】:
我的 ImageButton 不改变状态有问题。当我单击或触摸按钮时,它会保持相同的图像。这是我用作选择器的 XML。
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="true"
android:state_pressed="false"
android:drawable="@drawable/pushed" />
<item
android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/pushed" />
<item
android:state_focused="false"
android:state_pressed="true"
android:drawable="@drawable/pushed" />
<item
android:drawable="@drawable/default" />
</selector>
我将 main.xml 中的这个选择器称为
android:background="@drawable/imagechoice"
imagechoice.xml 是带有选择器的文件
我不明白为什么这不起作用,除非我必须有一些 java 代码,但我所看到的一切都说这应该起作用。
【问题讨论】:
-
这个问题你解决了吗?我有同样未解决的问题stackoverflow.com/questions/19435660/…
标签: android selector state imagebutton