title: Android: How do I switch the image of an ImageButton when the user releases the button?
body: <p>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.</p>
  
  <p>I'm trying to use a selector to make this happen:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:state_pressed="true"
      android:drawable="@drawable/record_on" /&gt;
    &lt;item android:state_focused="true"
      android:drawable="@drawable/record_off" /&gt;
    &lt;item android:drawable="@drawable/record_off" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>Is there a way to get this kind of behavior with an ImageButton, or should I be using something different?</p>