title: Customizing tabs on state in Android
body: <p>I know how to put the icon on each tab, that is no problem. I also ran across this :
  [Stack Overflow thread on pretty much same thing][1]</p>
  
  <p>I followed one of the links from that question and found [this][2]</p>
  
  <p>Pretty much, it said to use a selector defined in the XML, sure, did that. But there is no id associated w/ it so I am not sure how to get the selector function as a drawable so I can use it as the icon for the tabs. Maybe I am going about this the wrong way. But this is what I have, and obviously missing something.</p>
  
  <pre><code>&lt;selector
      android:id="@+id/myselector"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;!-- Non focused states --&gt;
      &lt;item
          android:state_focused="false"
          android:state_selected="false"
          android:state_pressed="false"
          android:drawable="@drawable/darklogo" /&gt;
      &lt;item
          android:state_focused="false"
          android:state_selected="true"
          android:state_pressed="false"
          android:drawable="@drawable/lightlogo" /&gt;
  
      &lt;!-- Focused states --&gt;
      &lt;item
          android:state_focused="true"
          android:state_selected="false"
          android:state_pressed="false"
          android:drawable="@drawable/lightlogo" /&gt;
      &lt;item
          android:state_focused="true"
          android:state_selected="true"
          android:state_pressed="false"
          android:drawable="@drawable/lightlogo" /&gt;
  
      &lt;!-- Pressed --&gt;
      &lt;item
          android:state_pressed="true"
          android:drawable="@drawable/lightlogo" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>In my code, an example tab is generated using :</p>
  
  <pre><code>  host.addTab(host.newTabSpec("three")  
                  .setIndicator("map",drawables)  
                  .setContent(new Intent(this, Map.class))); 
  </code></pre>
  
  <p>Right now drawable is just a reference to a drawable image resource. How do I make the selector a drawable? </p>
  
  <p>This is my question  [1]: <a href="https://stackoverflow.com/questions/36881/updating-android-tab-icons">Updating Android Tab Icons</a> [2]: <a href="http://groups.google.com/group/android-evelopers/browse_thread/thread/ef3bdebcb715b385" rel="nofollow noreferrer">http://groups.google.com/group/android-evelopers/browse_thread/thread/ef3bdebcb715b385</a></p>