I would like to create a menu button in my ActionBar Sherlock that will trigger the menu options I have in a xml file.
I have also created this options_menu but it is only triggered when user clicks on the hardware key (for example in S3, to trigger the menu you should click on left handed side button from the Home button)
I would like to have a button like this on my action bar (the 3 little square button on the right top corner)
The overflow menu is only shown on devices which don't have the hardware keys. It is considered an Action bar Anti-Pattern.
However if you still want to do it, this is how you do it
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if(menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception e) {
e.printStackTrace();
}