title: Accessing actionView in the ActionBar
body: <p>I would like to create an always-expanded search window in my action bar. I am using the ActionBar Sherlock library. According to some samples I have found, this code should do the trick</p>
  
  <pre><code>    public boolean onCreateOptionsMenu(Menu menu) {
      MenuInflater inflater = this.getSupportMenuInflater();
      inflater.inflate(R.menu.action_bar, menu);
  
      MenuItem searchItem = menu.findItem(R.id.action_bar_search);
      SearchView searchView = (SearchView) searchItem.getActionView();  //returns null
      searchView.setIconifiedByDefault(false);
  
  
      return true;
  }
  </code></pre>
  
  <p>however, getActionView(); returns null.
  Is there some other way to get to the searchView, so that I can call the setIconifiedByDefault(false); method ?
  I would like to keep the definition of the searchView in the xml file as follows</p>
  
  <pre><code> &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
      &lt;item android:id="@+id/action_bar_search"
            android:title="@string/action_bar_search"
            android:icon="@drawable/ic_magnify"
            android:showAsAction="always"
            android:actionViewClass="android.widget.SearchView" /&gt;
      &lt;/menu&gt;
  </code></pre>
  
  <p>Thanks for any help</p>