I try to make it so that as long as the user touches the button, it shows one image, and when the user releases the button, it returns to the default image.
I am trying to use a selector to make this happen:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/record_on" /> <item android:state_focused="true" android:drawable="@drawable/record_off" /> <item android:drawable="@drawable/record_off" /> </selector>
I tried several things with the selector, but it always produces the same behavior: the button starts with the default image, then I click on it and it changes to the βrecord_onβ image and it never returns to the default image when I'm letting go
Is there a way to get this behavior using ImageButton, or should I use something else?
source share