title: How to hide 3 dot icon in toolbar when no id or menu item xml available
body: <p>This question has been asked a number of times, but I cannot seem to hide the 3 dots icon.</p>
  
  <p>There is no <code>action_settings</code> menu item in <code>menu_main.xml</code>, and yet the settings icon appears none the less. </p>
  
  <p>I can't hide it in <code>onPrepareOptionsMenu</code> because there is no id for the icon</p>
  
  <pre><code>@Override
  public boolean onPrepareOptionsMenu(Menu menu) {
      MenuItem item= menu.findItem(R.id.menu_settings);
      item.setVisible(false);
      super.onPrepareOptionsMenu(menu);
      return true;
  }
  </code></pre>
  
  <p>My main activity lay out begins:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;include
          android:id="@+id/toolbar_actionbar"
          layout="@layout/toolbar_default"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" /&gt;
  
      &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/drawer_layout"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_below="@+id/toolbar_actionbar"&gt;
  
          &lt;LinearLayout
  
          ....
  </code></pre>
  
  <p>and layout <code>toolbar_default</code> is</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"
      xmlns:appcompat="http://schemas.android.com/apk/res-auto"
      style="@style/ToolBarStyle"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="?attr/colorPrimary"
      android:minHeight="@dimen/abc_action_bar_default_height_material"/&gt;
  </code></pre>
  
  <p>and <code>menu_main.xml</code> is</p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:appcompat="http://schemas.android.com/apk/res-auto"&gt;
  
      &lt;item
          android:id="@+id/menu_search"
          android:title="@string/menu_search"
          appcompat:actionViewClass="android.support.v7.widget.SearchView"
          appcompat:showAsAction="always"/&gt;
  
  &lt;/menu&gt;
  </code></pre>
  
  <p>and <code>ToolBarStyle</code></p>
  
  <pre><code>&lt;style name="ToolBarStyle" parent=""&gt;
      &lt;item name="popupTheme"&gt;@style/ThemeOverlay.AppCompat&lt;/item&gt;
      &lt;item name="theme"&gt;@style/ThemeOverlay.AppCompat.Dark.ActionBar&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="CustomPrefTheme" parent="Theme.AppCompat.NoActionBar"&gt;
      &lt;item name="android:checkboxStyle"&gt;@style/AppTheme.Preference.Checkbox&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>