How to set menu to Toolbar in Android
<p>I want use <code>ToolBar</code> instead of <code>ActionBar</code>, but don't show me menu in toolbar!!! i want set menu such as <strong>Refresh</strong> or <strong>Setting</strong> buttons in <code>ActionBar</code>.<br></p>
<p><a href="https://i.stack.imgur.com/R1qfam.png" rel="noreferrer"><img src="https://i.stack.imgur.com/R1qfam.png" alt="enter image description here" /></a></p>
<p><strong>Toolbar.xml code :</strong></p>
<pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;android.support.v7.widget.Toolbar
    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:background=&quot;?attr/colorPrimary&quot;
    android:minHeight=&quot;?attr/actionBarSize&quot;
    app:navigationContentDescription=&quot;@string/abc_action_bar_up_description&quot;
    app:popupTheme=&quot;@style/ThemeOverlay.AppCompat.Light&quot;
    app:theme=&quot;@style/ThemeOverlay.AppCompat.Dark.ActionBar&quot;
    app:title=&quot;Main Page&quot;
    android:gravity=&quot;center&quot;/&gt;
</code></pre>
<p><strong>MainPage.java code:</strong></p>
<pre class="lang-java prettyprint-override"><code>public class MainPage extends AppCompatActivity {
    private Toolbar toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_page);

        toolbar = (Toolbar) findViewById(R.id.main_toolbar);
        setSupportActionBar(toolbar);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setTitle(&quot;Main Page&quot;);
        }
        toolbar.setSubtitle(&quot;Test Subtitle&quot;);
        toolbar.inflateMenu(R.menu.main_menu);
    }
}
</code></pre>
<p><strong>main_menu.xml code :</strong></p>
<pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;menu xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;

    &lt;item
        android:id=&quot;@+id/menu_main_setting&quot;
        android:icon=&quot;@drawable/ic_settings&quot;
        android:orderInCategory=&quot;100&quot;
        app:showAsAction=&quot;always&quot;
        android:actionLayout=&quot;@layout/toolbar&quot;
        android:title=&quot;Setting&quot; /&gt;

    &lt;item
        android:id=&quot;@+id/menu_main_setting2&quot;
        android:icon=&quot;@drawable/ic_settings&quot;
        android:orderInCategory=&quot;200&quot;
        app:showAsAction=&quot;always&quot;
        android:actionLayout=&quot;@layout/toolbar&quot;
        android:title=&quot;Setting&quot; /&gt;

&lt;/menu&gt;
</code></pre>
<p>How to fix this problem and show menu in <code>Toolbar</code> ? thanks all dears &lt;3</p>