title: Why does the SearchView appear twice on the toolbar/actionbar?
body: <p>In the following SSCCE, the <code>SearchView</code> appears <strong>twice</strong> on the <code>Toolbar</code>/<code>ActionBar</code>. <strong>The question is why!</strong></p>
  
  <p><a href="https://i.stack.imgur.com/qUCYt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qUCYt.png" alt="enter image description here"></a></p>
  
  <p><strong><em>SSCCE</em></strong></p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      private TextView textView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.activity_main);
          textView = (TextView) findViewById(R.id.mainActivity_textView);
  
  
  
          handleIntent(getIntent());
      }
  
      @Override
      protected void onNewIntent(Intent intent) {
          setIntent(intent);
          handleIntent(intent);
      }
  
      private void handleIntent(Intent intent) {
          if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            String query = intent.getStringExtra(SearchManager.QUERY);
            doMySearch(query);
          }
      }
  
      private void doMySearch(String searchQuery) {
          textView.setText(searchQuery); 
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
  
          // Inflate the options menu from XML
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.main, menu);
  
          // Get the SearchView and set the searchable configuration
          SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
          MenuItem searchMenuItem = menu.findItem(R.id.action_search);
          SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
          // Assumes current activity is the searchable activity
          searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
          //searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
  
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p><strong>activity_main.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="practice_projects.materialdesigngooglenowlikesearchviewgive.MainActivity" &gt;
  
      &lt;include android:id="@+id/mainActivity_toolbar"
          layout="@layout/app_bar"/&gt;
  
      &lt;TextView
          android:id="@+id/mainActivity_textView"
          android:layout_below="@id/mainActivity_toolbar"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/hello_world" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>app_bar.xml</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" &gt;
      &lt;/android.support.v7.widget.Toolbar&gt;
  </code></pre>
  
  <p><strong>res/menu/main.xml</strong></p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      tools:context="practice_projects.materialdesigngooglenowlikesearchviewgive.MainActivity" &gt;
  
      &lt;item 
          android:id="@+id/action_search"
          android:orderInCategory="100"
          android:title="@string/searchMenuIcon_title"
          android:icon="@drawable/ic_search_black_24dp"
          app:showAsAction="always"
          app:actionViewClass="android.support.v7.widget.SearchView"
          app:iconifiedByDefault="false" /&gt; 
  
  &lt;/menu&gt;
  </code></pre>
  
  <p><strong>res/xml/searchable.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;searchable xmlns:android="http://schemas.android.com/apk/res/android"
      android:label="@string/app_name"
      android:hint="@string/search_hint" &gt;
  &lt;/searchable&gt;
  </code></pre>
  
  <p><strong>res/values/styles.xml</strong></p>
  
  <pre><code>&lt;resources&gt;
      &lt;style name="AppBaseTheme" parent="Theme.AppCompat.Light"&gt;
          &lt;item name="colorPrimary"&gt;@color/primary&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/primaryDark&lt;/item&gt;
          &lt;item name="colorAccent"&gt;@color/accent&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="AppTheme" parent="AppBaseTheme"&gt;&lt;/style&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p><strong>res/values*-v21*/styles.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
      &lt;style name="AppTheme" parent="AppBaseTheme"&gt;&lt;/style&gt;
  &lt;/resources&gt;
  </code></pre>