How to make a button in the upper right corner of 3 points, when clicked, the button "help" will come out, and this button in turn will display a help dialog box.

Now in my application the theme is "Theme.AppCompat.Light.DarkActionBar", and by default there is no such button.

<application android:allowBackup="true" android:icon="@mipmap/light" android:label="@string/app_name" android:roundIcon="@mipmap/light" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:icon="@mipmap/light" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">#e5a840</item> <item name="colorPrimaryDark">#c47505</item> <item name="colorAccent">#440000</item> </style> 

    1 answer 1

    You need to create a resource menu ( res->menu PCM New-> Menu resource file ), for example spravka.xml

     <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/popup_spravka" android:title="Справка" app:showAsAction="never" /> </menu> 

    Next in the override method override:

     @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.spravka, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.popup_spravka: myPopup_spravka(); break; default: break; } return super.onOptionsItemSelected(item); } 

    Instead of myPopup_spravka() you need to specify your method.