open action bar overflow menu programatically in Android app - android

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

Related

Android: Create a Quick Action Menu

I need to create some type of quick action menu that appears to the right side of the clicked item (button) whenever the user clicks the button.
Here's an example of what I'm trying to achieve:
When the user clicks button1 I want the "sub quick action menu" to appear like it's shown in the image above.
Is there anyway to do this 'natively' in android?
I have found this plugin but it only allows you to show the menu from the top or bottom of the button.
https://github.com/lorensiuswlt/NewQuickAction3D
As tyczj said, you could achieve that with a PopupMenu. The idea is that the popup menu will inflate a custom view with all the elements, having as background a 9 patch image.
Here's a blog post that shows how to do that. Hope it will help you.
You can do the same using Quick Action Menu, for more details you can follow the
"http://www.codeproject.com/Articles/521455/Quick-action-pattern-in-Android-and-simple-impleme"
Link.
In example Items are presented in horizontal manner, whereas you can manage them, like listview as per your requirement.
there is a PopupMenu but there is no arrow or anything pointing to where it came from. Its basically the same thing that comes up when clicking the Overflow actionbar item
Maybe this link can help you ;) But instead of sliding use press button.
Making a slide menu

Can we implement a list on ActionBar using Sherlock Library in Android?

I am using Action Bar in my application to implement Tab Fragments. I am successful in it. But getting a small problem. I am in a need of a drop-down list at the Right Corner of the action bar and a search button. Please see the image:
You can see the red marked buttons that i need to show in Action bar and below the actionbar we have tab fragments. I am successful in generating the Fragments but getting problem in showing these buttons on Actionbar. Please help me
The overflow button is automatically generated but if you have a phone with hardware button it wont show up. You shouldn't try to force it to show up as it goes against ussual behaviour for people with phones that have a hardware button.

ActionBar and sliding out menu in android

I just want to create an action bar as foursquare app.
and i want to show a slide out menu when the home button pressed just like the image shown.
I am able to create the custom action bar but not like the first image. Please provide any tutorial which will help to create the Action bar
You may use the version included in the Google Android SDK (instead of an 3rd party lib.)
Read about Navigation Drawer for more details.
SlidingMenu is a great and easy-to-use library for this.
edit: Sorry, thought the question was only about the slide-in menu.
For actionbar, your best library will be ActionbarSherlock

Use share button (like in ICS gallary) instead of share dialoge (Intent.ACTION_SEND)

I am trying to find a way to impelement a share button into my app (same like the one in the standard ICS gallary app, see picture link).
http://betanews.com/2011/10/19/get-acquainted-with-the-newest-android-ice-cream-sandwich-slideshow/#11
Intent.ACTION_SEND only opens a dialoge to the select the sharing options.
Android Share Via Dialog
This works fine, but from design side, I find this drop down list to select a app much more convenient.
Yet I cant figure out how to?
Does anybody have a good Idea how this button could be coded?
That is implemented using a ListPopupWindow, which at the moment is only available on Android 4.0.
This is implemented using ShareActionProvider available in SDK14+.
ActionProvider class replaces an action item with a customized layout,
but it also takes control of all the item's behaviors. When you
declare an action provider for a menu item in the action bar, it not
only controls the appearance of the item in the action bar with a
custom layout, but also handles the default event for the menu item
when it appears in the overflow menu
Its quiet easy to implement, you can follow the official documentation here.

Whether options menu at the bottom in Android can be made permanent?

Whether options menu at the bottom (Inflated menu) can be made permanent? The menu should be permanently inflated without the need for user to press the menu button?
whether it can be done?
whether it can be done?
No.
Besides, that menu is going away. Honeycomb and Ice Cream Sandwich are moving to the action bar pattern, where the options menu is integrated into the action bar as a drop-down menu and optional toolbar buttons.
If you want to give the user some always-visible set of actions, consider adding the action bar to your own applications. You can do this on pre-Honeycomb devices using third-party action bar implementations like ActionBarSherlock.
You can wrap your layout in a relativelayout and add buttons to the bottom. You can have it look similar too.
As Bill said you can add buttons in Relative layout and not create menu...if you need some code just tell me...
In which version you want the solution ,
in tab versions and 4.0 you can solve this problem as follows.
in manifest file add this attibute to application Tag android:uiOptions="splitActionBarWhenNarrow" so that your actionbar shows in the bottom. while your mobile is in portrait , in landscape it shows as usual on the top
and them add this flag to your menu item
MenuItem.SHOW_AS_ACTION_ALWAYS
check this link for more flags http://developer.android.com/reference/android/view/MenuItem.html i hope this will solve the issue

Categories

Resources