ImageView src with drawable selector ignores enabled state

marmor picture marmor · May 3, 2012 · Viewed 12k times · Source

When using a state selector as the src for an ImageView, enabled="false" is being ignored.

i.e. this doesn't work properly:

<ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:enabled="false"
        android:src="@drawable/state_drawable" >

P.S. : I have an ugly workaround, I'll post it as an answer shortly, if you have something better or an explanation for this behavior, please let me know.

Answer

Changwei Yao picture Changwei Yao · May 3, 2012

Try to add the property android:clickable="true"