title: Menu action items goes to overflow menu
body: <p>You will have to forgive me, because I am still pretty new to android development. For my android app, I am staying to create a custom menu and place on the tool bar with the java code in a base activity that is extended by the other activities. But for some reason, the menu buttons are hiding in the overflow menu even though there is more than enough room for them to be showing. I feel like my code is correct, but I need to add a reference to something somewhere else that I am missing. Thanks in advance!</p>
  
  <p><a href="https://i.stack.imgur.com/np3dP.png" rel="nofollow noreferrer">Current toolbar appearance</a></p>
  
  <p>BaseActivity.java</p>
  
  <pre><code>public abstract class BaseActivity extends AppCompatActivity {
  
      private Toolbar toolBar;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(getLayoutResource());
  
          toolBar = (Toolbar) this.findViewById(R.id.toolbar);
  
          if (toolBar != null) {
              setSupportActionBar(toolBar);
              if (getSupportActionBar() != null) {
                  setDisplayHomeEnabled(true);
              }
          }
      }
  
      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, menu);
          return true;
      }
  
      protected abstract int getLayoutResource();
  
      public void setDisplayHomeEnabled(boolean b) {
          if (getSupportActionBar() != null) {
              getSupportActionBar().setDisplayHomeAsUpEnabled(b);
          }
      }
  
      @Override
      public void setTitle(CharSequence title) {
          toolBar.setTitle(title);
      }
  
      @Override
      public void setTitle(int titleId) {
          toolBar.setTitle(titleId);
      }
  
      public Toolbar getToolBar() {
          return toolBar;
      }
  }
  </code></pre>
  
  <p>toolbar.xml</p>
  
  <pre><code>&lt;LinearLayout 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"
      android:fitsSystemWindows="true"
      android:orientation="vertical"&gt;
  
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:minHeight="?attr/actionBarSize"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:titleTextColor="@android:color/white"
          android:background="?attr/colorPrimary"&gt;
      &lt;/android.support.v7.widget.Toolbar&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>main_menu.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;item
          android:id="@+id/menu_settings"
          android:title="Settings"
          android:icon="@android:drawable/ic_menu_preferences"
          android:showAsAction="always"/&gt;
  
      &lt;item
          android:id="@+id/menu_search"
          android:title="Search"
          android:showAsAction="always"
          android:icon="@android:drawable/ic_menu_search"
          android:actionViewClass="android.widget.SearchView"/&gt;
  
  &lt;/menu&gt;
  </code></pre>