title: Expand Search View to use entire Action Bar (hide other things)
body: <p>I have a <code>SearchView</code> inside my <code>ActionBar</code>, and I want to use the entire <code>ActionBar</code> when the search icon is pressed, but I can only use the <code>ActionBar</code> free space</p>
  
  <p>eg.: <a href="http://imgur.com/wnjMfWO">http://imgur.com/wnjMfWO</a></p>
  
  <p>my menu code:</p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  tools:context="br.com.moderna.houaiss.activity.SearchActivity" &gt;
  
  &lt;item
      android:id="@+id/search"
      android:actionViewClass="android.widget.SearchView"
      android:icon="@drawable/ic_search_white_48dp"
      android:showAsAction="collapseActionView|always"
      android:title="@string/search"/&gt;
  &lt;item
      android:id="@+id/backWardHistory"
      android:icon="@drawable/ic_arrow_back_white_48dp"
      android:showAsAction="always"
      android:title="@string/back_history"/&gt;
  &lt;item
      android:id="@+id/forWardHistory"
      android:icon="@drawable/ic_arrow_forward_white_48dp"
      android:showAsAction="always"
      android:title="@string/forward_history"/&gt;
  &lt;item
      android:id="@+id/action_home"
      android:orderInCategory="100"
      android:showAsAction="never"
      android:title="@string/action_home"/&gt;
  &lt;item
      android:id="@+id/action_about"
      android:orderInCategory="100"
      android:showAsAction="never"
      android:title="@string/action_about"/&gt;
  &lt;item
      android:id="@+id/action_configuration"
      android:orderInCategory="100"
      android:showAsAction="never"
      android:title="@string/action_configuration"/&gt;
  &lt;item
      android:id="@+id/action_logout"
      android:orderInCategory="100"
      android:showAsAction="never"
      android:title="@string/action_logout"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>I had tryed <code>android:showAsAction="ifRoom"</code>, but I need them to be always on my <code>ActionBar</code>, and not inside my menu.</p>
  
  <p>EDIT ------</p>
  
  <p>Thanks to @Simas, </p>
  
  <p>I used setOnActionExpandListener method to achieve this effect</p>
  
  <pre><code>final MenuItem searchItem = menu.findItem(R.id.search);
  
      searchItem.setOnActionExpandListener(new OnActionExpandListener() {
  
          @Override
          public boolean onMenuItemActionExpand(final MenuItem item) {
              SearchActivity.this.setItemsVisibility(menu, searchItem, false);
              return true;
          }
  
          @Override
          public boolean onMenuItemActionCollapse(final MenuItem item) {
              SearchActivity.this.setItemsVisibility(menu, searchItem, true);
              return true;
          }
      });
  
  
  private void setItemsVisibility(final Menu menu, final MenuItem exception,
          final boolean visible) {
      for (int i = 0; i &lt; menu.size(); ++i) {
          MenuItem item = menu.getItem(i);
          if (item != exception)
              item.setVisible(visible);
      }
  }
  </code></pre>