android - MenuItem showing up on a bottom bar -
when inflate menu, of item showing in bottom bar, while others show in usual options menu of android 2. tried android:uioptions="none" in manifest, bottom bar disappear , options menu remain.
what want add menu item action bar!
here menu layout
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/menu_support" android:icon="@drawable/icon_close" android:showasaction="always" android:title="@string/menu_support" android:visible="true"/> <item android:id="@+id/menu_feedback" android:orderincategory="100" android:showasaction="never" android:title="@string/menu_feedback"/> <item android:id="@+id/menu_settings" android:orderincategory="100" android:showasaction="never" android:title="@string/menu_settings"/> </menu> and here oncreatemenuoptions:
@override public boolean oncreateoptionsmenu(menu menu) { getsupportmenuinflater().inflate(r.menu.activity_main, menu); return true; }
the options menu visible because new design devices not have menu button.
i guess have setdisplayshowhomeenabled(false) , setdisplayshowtitleenabled(false). when set android:uioptions none, cause actionbar go away, keeps options menu icon. need keep splitactionbarwhennarrow if you're disabling top actionbar.
finally crux of question. have 1 item set android:showasaction=always. option show icon on action bar. other 2 set never. show in options menu.
never = show action icon on action bar.
ifroom = show action icon on action bar if there room on action bar, put in options menu when there isn't room.
always = shown in option menu.
|withtext = adds hint show action's title if there room on action bar.
the rule of thumb set 2 items shown actions actionbar not crowded on small devices. on larger devices ifroom options displayed actionbar items rather option menu items.
Comments
Post a Comment