java - Show action bar also for menu button? -
i'm creating action bar on ics. due spacing icons displayed. i'd supply action bar context-like menu with text if menu button of phone pressed.
how can achieve this?
atm have 3 icons. 2 of them displayed @ top in action bar. if press menu phone button, 3rd displayed contextmenu! i'd have 3 of them.
class myactivity extends sherlockfragmentactivity { @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getsupportmenuinflater(); /* implementation here */ } }
from documentation on menus:
if menu item not appear action item, system places in overflow menu.
thus, showing same action item in both action bar and overflow menu not possible. could this:
check (at runtime) menu items fit in action bar , not.
for each menu item displayed in action bar, create new, identical menu item dynamically, making sure call
newmenuitem.setshowasaction(show_as_action_never)
ensure displayed in overflow menu (w/ text).
this, in opinion, goes against android's menu design standards , wouldn't suggest doing it. might appear better design choice in eyes, users expect apps consistent across entire android platform. manipulating menus in weird ways can cause confusion, , can negatively impact user experience result.
Comments
Post a Comment