title: how to highlight action bar item select in android
body: <p>I am creating an app wherein I have three items in the action bar. I want that when I click on  one of the item, it should get highlighted. </p>
  
  <p>I went through few examples available but concluded that I will have to create style using
  ActionBar Style Generator tool.</p>
  
  <p>I referred the following link.. but was not satisfied</p>
  
  <p><a href="https://stackoverflow.com/questions/15717356/how-to-highlight-a-menu-item-on-selection">how to highlight a menu item on selection?</a></p>
  
  <p>Is this the only way to go about?</p>
  
  <pre><code>&lt;!-- Application theme. --&gt;
  &lt;style name="AppTheme" parent="AppBaseTheme"&gt;
      &lt;item name="android:actionBarItemBackground"&gt;@drawable/action_bar_item_selector&lt;/item&gt;
      &lt;!-- All customizations that are NOT specific to a particular API-level can go here. --&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>selector.xml</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_focused="true"
      android:drawable="@drawable/ic_action_blue" /&gt;
    &lt;item android:state_pressed="true"
      android:drawable="@drawable/ic_action_green" /&gt;
    &lt;item android:drawable="@android:color/transparent" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>But the selection does not remain stagnant as it is for state_pressed and state_focused.</p>
  
  <p>I want the item to remain highlighted till the user is on that activity.</p>