I'm trying to make it so that as long as a user is touching the button, it shows one image, and when the user releases the button, it goes back to a default image.
I'm 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've tried a few things with the selector, but it always produces the same behavior: the button starts out with the default image, then I press it and it changes to the "record_on" image and it never goes back to the default image when I let go.
Is there a way to get this kind of behavior with an ImageButton, or should I be using something different?