title: How to set menu to an AppBarLayout
body: <p>I'm new to programming, and I want to add a settings menu button.</p>
  <p>Like on the picture, my app doesn't show the three dots button.</p>
  <p><a href="https://i.stack.imgur.com/yxrXZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yxrXZ.jpg" alt="My Application" /></a></p>
  <p>MainActivity.java :</p>
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager());
          ViewPager viewPager = findViewById(R.id.view_pager);
          viewPager.setAdapter(sectionsPagerAdapter);
          TabLayout tabs = findViewById(R.id.tabs);
          tabs.setupWithViewPager(viewPager);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.settings, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(@NonNull MenuItem item) {
          switch (item.getItemId()) {
              case R.id.vueSatellite:
                  Toast.makeText(this, &quot;Hi&quot;, Toast.LENGTH_SHORT).show();
                  return true;
              default:
                  return super.onOptionsItemSelected(item);
          }
      }
  }
  </code></pre>
  <p>activity_main.xml :</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  
  &lt;androidx.coordinatorlayout.widget.CoordinatorLayout 
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;&gt;
  
      &lt;androidx.viewpager.widget.ViewPager
          android:id=&quot;@+id/view_pager&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          app:layout_behavior=&quot;@string/appbar_scrolling_view_behavior&quot; /&gt;
  
      &lt;com.google.android.material.appbar.AppBarLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:theme=&quot;@style/AppTheme&quot;&gt;
  
          &lt;TextView
              android:id=&quot;@+id/title&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:gravity=&quot;center&quot;
              android:minHeight=&quot;?actionBarSize&quot;
              android:padding=&quot;@dimen/appbar_padding&quot;
              android:text=&quot;@string/app_name&quot;
              android:textColor=&quot;@color/colorAccent&quot;
              android:textAppearance=&quot;@style/TextAppearance.Widget.AppCompat.Toolbar.Title&quot; /&gt;
  
          &lt;com.google.android.material.tabs.TabLayout
              android:id=&quot;@+id/tabs&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:background=&quot;@color/White&quot;
              app:tabTextColor=&quot;@color/colorAccent&quot;/&gt;
      &lt;/com.google.android.material.appbar.AppBarLayout&gt;
  
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>
  <p>settings.xml :</p>
  <pre><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/vueSatellite&quot;
              android:title=&quot;@string/item_vue_satellite&quot;
              app:showAsAction=&quot;never&quot;/&gt;
  
      &lt;/menu&gt;
  </code></pre>
  <p>What is my mistake ?</p>
  <p>Or what do I have to add?</p>
  <p>Tell me if there is missing information like the file AndroidManifest.xml for example.</p>
  <p>Thanks</p>