How to use Overflow menu in TabActivity? - android

I want to use overflow menu for device which not have menu button(hardware).
I use overflow menu in simple Activity project it work fine. But in tabActivity overflow menu not visible at top corner(three dot).
How to use overflow menu in tabActivity?
I am also use,
android:showAsAction="never"
And
I refer this answer
It work fine, but not in TabActivity.
Please help me.
Thanks in Advance.

Related

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.

Android menu on overflow BUT NOT not actionbar

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.

how to explicitelly add items to the overflow menu in the actionbar

I was wondering if it is possible to put items directly in the overflow menu on the actionbar. I am using ActionbarSherlock for my app (if this is relevant). I have several menu items, for instance: Add, Delete, Sort, About app, etc. These are all items for my actionbar menu. I would like to leave only "Add" outside, and put the rest in the overflow menu. Is there any way to do that?
I was wondering if it is possible to put items directly in the overflow menu on the actionbar.
Yes, set the attribute showAsAction to "never":
<item android:id="#+id/item"
android:title="#string/item"
android:showAsAction="never"/>

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