I wanted to create a context menu in the android studio project, wrote the following in the MainActivity class (This menu is exactly what you need to activate):
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } Here is the xml code for this menu:
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/mnbt1" android:title="@string/settings.nazvanie" app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider" tools:icon="@drawable/mr_button_light" app:showAsAction="never"> </item> <item android:id="@+id/mnbt2" android:title="@string/spravka" app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider" tools:icon="@drawable/mr_button_light" app:showAsAction="never"/> <item android:id="@+id/mnbt3" android:title="@string/about" app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider" tools:icon="@drawable/mr_button_light" app:showAsAction="never"/> </menu> And when you start the application on the mobile device of this menu itself, or rather the "3 points" is not ... I tried everything, earlier everything worked on the old project, but now something is not right ...
Maybe in the API business? I use API 24. I myself have ActionBar, but the elements in it are not displayed ... I myself am a newcomer to the development of mobile. applications.
return super.onCreateOptionsMenu(menu);instead oftrue- YuriySPb ♦