title: Selector on background color of TextView
body: <p>I'm attempting to change the background color of an Android <code>TextView</code> widget when the user touches it. I've created a selector for that purpose, which is stored in <code>res/color/selector.xml</code> and roughly looks like that:</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:color="@color/semitransparent_white"
          /&gt;
      &lt;item
          android:color="@color/transparent"
          /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>The <code>clickable</code> attribute of the <code>TextView</code> is <strong><code>true</code></strong>, in case that's of interest.</p>
  
  <p>When I assign this selector to a <code>TextView</code> as <code>android:background="@color/selector"</code>, I'm getting the following exception at runtime:</p>
  
  <blockquote>
    <p>ERROR/AndroidRuntime(13130): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #6:  tag requires a 'drawable' attribute or child tag defining a drawable</p>
  </blockquote>
  
  <p>When I change the attribute to drawable, it works, but the result is looking completely wrong because the IDs appear to be interpreted as image references instead of color references (as the "drawable" suggests).</p>
  
  <p>What confuses me is that I can set a color reference, e.g. "@color/black", as the background attribute directly. This is working as expected. Using selectors doesn't work.</p>
  
  <p>I can also use the selector as the <code>textColor</code> without problems.</p>
  
  <p><strong>What's the correct way to apply a background-color-selector to a <code>TextView</code> in Android?</strong></p>