title: How do I change the tint of an ImageButton on focus/press
body: <p>I have an <code>ImageButton</code> in my app and I need to change the tint of the image when the button is <code>pressed/focused</code>. I have the <code>ImageButton</code> set to get its <code>src</code> from an XML file which as follows:</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;!-- pressed --&gt;
      &lt;item 
          android:state_pressed="true"
          android:tint="@color/black"
          android:drawable="@drawable/search"
          /&gt;
  
      &lt;!-- focused --&gt;
      &lt;item 
          android:state_focused="true"
          android:tint="@color/black"
          android:drawable="@drawable/search"
          /&gt;
  
      &lt;!-- default --&gt;
      &lt;item
          android:tint="@null"
          android:drawable="@drawable/search"
          /&gt;
  
  &lt;/selector&gt;
  </code></pre>
  
  <p>However the tint isn't applied when the <code>ImageButton</code> is pressed or focused - the image just displays as normal. The color black is defined as <code>#000000</code> as always. Any ideas?</p>