So, it turns out pretty simple, I recently implemented it in my application.
Items to be displayed in the overflow menu insert them into one menu item as follows:
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/empty" android:orderInCategory="101" android:showAsAction="always" android:icon="@drawable/ic_action_overflow"> <menu> <item android:id="@+id/action_settings" android:orderInCategory="96" android:showAsAction="never" android:title="@string/menu_settings" android:icon="@drawable/ic_action_settings"/> <item android:id="@+id/action_share" android:orderInCategory="97" android:showAsAction="never" android:title="@string/menu_share" android:icon="@drawable/ic_action_share"/> <item android:id="@+id/action_rate" android:orderInCategory="98" android:showAsAction="never" android:title="@string/menu_rate" android:icon="@drawable/ic_action_important"/> <item android:id="@+id/action_feedback" android:orderInCategory="99" android:showAsAction="never" android:title="@string/menu_feedback" android:icon="@drawable/ic_action_edit"/> </menu> </item> </menu>
Now edit the main activity file as follows:
package com.example.test; //all your import statements go here Menu mainMenu=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override 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); mainMenu=menu; return true; } //Menu press should open 3 dot menu @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_MENU) { mainMenu.performIdentifierAction(R.id.empty, 0); return true; } return super.onKeyDown(keyCode, event); }
source share