title: Android Theme drawable doesn't work with Color Drawable (Bug?)
body: <p>So I'm trying to make a <code>selector</code> that uses a theme-based color as its background. Following the instructions from <a href="https://stackoverflow.com/a/13735919/1852456">this SO answer</a>, I first define my color drawable in res/values/colors.xml:</p>
  
  <pre><code>&lt;color name="selected"&gt;#FFF7C9&lt;/color&gt;
  </code></pre>
  
  <p>Then I define an attribute in res/values/attrs.xml:</p>
  
  <pre><code>&lt;attr name="drawable_selected" format="reference" /&gt;
  </code></pre>
  
  <p>and then in my theme, I set attribute to my color drawable (res/values/styles.xml):</p>
  
  <pre><code>&lt;style name="AppThemeWhite" parent="AppTheme"&gt;
      &lt;item name="drawable_selected"&gt;@color/selected&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>finally, I reference the attribute in my selector (res/drawable/selected_background):</p>
  
  <pre><code>&lt;selector&gt;
      &lt;item android:state_activated="true" android:drawable="?drawable_selected" /&gt;
      &lt;item android:drawable="@android:color/transparent" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>When I run this, I get an error <code>Binary XML file line #2: Error inflating class &lt;unknown&gt;</code> when trying to inflate the class that uses the selector. However, when I change the selector's <code>state_activated</code> to reference the drawable directly using <code>android:drawable="@color/selected"</code>, it works. </p>
  
  <p>Is this a bug, or am I doing something wrong?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>If I add a color attribute (res/values/attrs.xml)</p>
  
  <pre><code>&lt;attr name="selected_color" format="color" /&gt;
  </code></pre>
  
  <p>and define the color in my theme (res/values/styles.xml)</p>
  
  <pre><code>&lt;item name="selected_color"&gt;#FFF7C9&lt;/item&gt;
  </code></pre>
  
  <p>I can change the color drawable to change based on them (res/values/colors.xml)</p>
  
  <pre><code>&lt;color name="selected"&gt;?selected_color&lt;/color&gt;
  </code></pre>
  
  <p>and reference the drawable directly using <code>android:drawable="@color/selected</code> in my selector.
  However, this causes a crash as well! And changing the color drawable back to a hardcoded value of <code>#FFF7C9</code> fixes it. It seems this whole theming system is pretty broken...</p>