title: android: customized text selector
body: <p>I wanted to design a customized text selector that changed the text color when user clicks the TextView. But got the following error:</p>
  
  <p>java.lang.RuntimeException: Unable to start activity ComponentInfo{}: android.view.InflateException: Binary XML file line #55: Error inflating class </p>
  
  <p>here is what I have:
   drawable/text_selector.xml</p>
  
  <pre><code>    &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; 
    &lt;item android:state_enabled="false" 
          android:state_focused="true" 
          android:drawable="@color/black" /&gt; 
    &lt;item android:state_pressed="true" 
          android:drawable="@color/blue" /&gt; 
    &lt;item android:state_focused="true" 
          android:drawable="@color/black" /&gt; 
  &lt;/selector&gt; 
  </code></pre>
  
  <p>layout/textview.xml</p>
  
  <pre><code>&lt;TextView android:id = "@+id/last_page_button"
      android:text="@string/last_page_button_string" 
      android:gravity="center_horizontal"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" 
      android:background="#ffffff"
      android:textColor = "@drawable/text_selector"
      android:layout_weight="1" /&gt;
  </code></pre>
  
  <p>values/color.xml</p>
  
  <pre><code>&lt;resources&gt; 
      &lt;color name="white"&gt;#ffffffff&lt;/color&gt; 
      &lt;color name="black"&gt;#ff000000&lt;/color&gt; 
      &lt;color name="blue"&gt;#ffccddff&lt;/color&gt;
  </code></pre>
  
  <p> </p>