I have made three different images for a next button in my activity. A focused image, normal image and an image when the button is not enabled.
However, I wanted to test it and see how ot looks when it's not been enabled.
So on start I set it to false and it does work, I cannot touch it and it does not change to focused anymore, but the image does not change.
The ImageButton
from my layout.
<ImageButton
android:id="@+id/nextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:padding="5dp"
android:src="@drawable/nextbutton" />
The selector file nextbutton.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_next_focused" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/btn_next_focused" android:state_focused="false" android:state_pressed="true"/>
<item android:drawable="@drawable/btn_next_focused" android:state_focused="true"/>
<item android:drawable="@drawable/btn_next" android:state_focused="false" android:state_pressed="false"/>
<item android:drawable="@drawable/btn_next_disabled" android:state_enabled="false"/>
</selector>
What is wrong? It'll only change to focused and normal state but never to the disabled one. (I just noticed that it might be the wrong word for it...).