I want to create a drawable resource to change the image used in an image button when it is disabled.
I have created a drawable resource
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:src="@drawable/enabled_image" />
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/disabled_image" />
</item>
</selector>
And then I am referencing it in the android:src="@drawable/resource"
. When I call ImageButton.setEnabled(false)
the button is not clickable but the style doesn't change.
android:background
is used for other stuff (radius colours etc)