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.
Related
I'm trying to create a custom popup/drop down menu on Android where when I click the action button from action bar the list of overflow options will appear but in a different format (image on right instead of left, button, etc). I tried to find some question and the one close to this is this question but the answer is incomplete and lacks the explanation. Now what I tried so far is to replicate it but removed the DropDown class but nothing happens as expected. I also tried some ways using the xml menu but its just giving me the same result of image on left and text on right. I think setActionView also doesn't work the way I expected it. Hope someone can help me on this.
I need to open android support library action bar overflow menu (the one shown with three vertical dots) programatically. I know its a silly requirement but one of my client is insisting that they want the menu option to be opened and visible when user tap on a button in an activity.
Any pointer on how to do this will be highly appreciated.
Try using openOptionsMenu in your Activity.
You can do something similar to this implementing your own custom ActionProvider Check this out, in the "Creating a custom action provider" section.
Hope it helps
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.
Is it possible to force three dot overflow menu to open from bottom? Just like older option menus - I'm on Android 4.2.2 through ActionbarSherlock.
There isn't a default option to achieve this as far as I know but you could overwrite the standard behaviour.
Nevertheless I wouldn't recommend doing this as the soft home button could be clicked by mistake and thus your application 'closed'.
Additionally you should orient yourself on the design guidelines and as this function is outdated you should use the new one.
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.