Sometime option menu icon in Actionbar is not displayed because the devices has hardware button for option menu.
The below code will help you to show option menu in such devices like Samsung S4.
write code in Application's OnCreate()
......................
The below code will help you to show option menu in such devices like Samsung S4.
write code in Application's OnCreate()
......................
/*
* This block is used to show Action bar menu icon at Top Right of The Action bar. because some Device has there * hardware button for menu and in that Devices menu button on ActionBar Hide Automatically. like Samsung S4 */ try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore }
No comments:
Post a Comment