Android menu on overflow BUT NOT not actionbar - android

any pointer as to how I could let my app running on android 3.0+ show the old menu ONLY on the overflow bar BUT not on the actionbar?
been trying to find this one out all over the web with no results!
any help is appreciated.

You can use the showAsAction attribute for MenuItem and set it to never to place the menu items in overflow menu.

Related

How to force show icons in actionBar menu

Per usual my ActionBar has a number of menu items that I set as app:showAsAction="never". So when user clicks on the overflow button, these items show up but they don't have icons. How do I force the icons to show? The answer at Is it possible to display icons in a PopupMenu? does not answer my question as it is concerned with the popup menu. When I tried to apply it to my case it shows all items not just the ones in the overflow. Also I am anchoring it in the toolbar as I don't know how to get the overflow view.
I don't think there is a simple way to toggle showing an icon in the action bar overflow menu. But I did find that someone was able to create a fully customized overflow menu:
http://keepsafe.github.io/2014/11/19/building-a-custom-overflow-menu.html

How to know if MenuItem is in ActionBar or Overflow

First of, I'm using SherlockActionBar.
I've one MenuItem that is 'always' showed in the ActionBar and one other MenuItem that is only showed 'ifRoom'. There are also other MenuItems that are 'never' showed in the ActionBar and therefore there exists a Overflow Icon (if device has no hardwarebutton).
My question now is, how am I able to tell if the MenuItem with 'ifRoom' is currently showed or not in the ActionBar (in ActionBar or Overflow?)? I need to know that because I'm using the ShowcaseView Library to highlight these options. Therefore I have to know if I should highlight the Overflow or I can directly target to the MenuItem.
Thx
Imo there is no way to know if a menu entry is on the overflow menu via an API.
Even with "never" you can still be pushed into the overflow menu when the the title is long and your device is very narrow.
What you could try is to place an action view into your menu items and get its position on screen. If not on screen you can be certain it is pushed into the overflow menu.

Overflow icon is not coming the Actionbar of ActionBarSherlock

I am new to Android. I am trying to use Actionbarsherlock in my application. I tried the following code in the onCreateOptionsMenu :
menu.add("Save").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add("Edit").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add("Clear").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add("Refresh").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add("Save all").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
But i am not getting the overflow icon in the actionbar. I understood its a silly mistake. But i couldn't find where it is. Please help me to fix it!
Since you are asking for MenuItem.SHOW_AS_ACTION_ALWAYS I think none of the Menu Items go in to OverFlow.
Also, If the device has a hardware menu button, then the extra icons will not go in to overflow, instead you can access them using the menu button.

Custom Overflow Menu Outside of ActionBar

I need to implement a custom overflow menu with menu items and the overflow icon if the screen size cannot show all the icons. I cannot use a side scroll since I am already inside an expanded list view. I cannot use the Top or bottom action bar menu because the action will change based on what list item has been expanded.
So I would like to create my own overflow menu - similar to the gmail screenshots attached
Any ideas? Apparently ABS can be used for this but I can't figure it out, please help :)
ListPopupWindow is what you're looking for. It's an API 11+ class, however. ABS includes a backported version which is basically just a ListView inside a PopupWindow (both API 1 classes).

How to arrange menu items in action bar to my liking ?

i was wondering if anyone could tell me how to choose which menu items go in to the actiobar and which ones go into the overflow menu, i have five menu items and the ones i want in the actionbar go in the overflow and the one i want in the overflow are in the actiobar.
How can i rearrange the actionbars?
Any help will be appreciated
There are two things you can do.
First you can set the flag
android:showAsAction="ifRoom"
This will show items if there is room, if not they will be placed in the overflow menu.
Second, the XML file is scanned linearly. So just put your actions that you in the overflow menu to the bottom.
The documentation states
Menu items that are not promoted to an action item are available in the overflow menu, revealed by
either the device Menu button (when available) or by an "overflow menu" button in the action bar
(when the device does not include a Menu button).
Here is also an good post with more information.
How to force overflow menu on android actionbar compat?

Categories

Resources