I am implementing custom ActionBar, how should I handle the overflow menu (3 dots icon on the right here: http://developer.android.com/images/ui/actionbar.png )? The overflow menu should be visible if there is no hardware menu button - but how can I detect that?
I'm not using the system ActionBar, because I need a customized behavior.
ViewConfiguration.get(context).hasPermanentMenuKey()
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();
}
}
The menu button is somewhat outdated , maybe you want to reconsider and stick to the overflow menu? And by the way, do you know http://actionbarsherlock.com/ ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.