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.
Try to add the property android:clickable="true"
Possible workaround: use a TextView
with a compound drawable:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/state_drawable"
android:enabled="false" />
This seems to work, and pull the right drawable from state_drawable, but not very intuitive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With