I'd like to use a drop-down menu for letting the user choose an action (in this case, they select some items from a list, and use the menu to select "delete", "move" etc.)
The way Spinner works is quite close to what I want, except Spinner is clearly designed for selecting some data, rather than issuing a command.
Before it is clicked, I'd like the drop-down menu to just look like an arrow (no adjacent space for displaying the 'currently selected' data
Ideally the drop-down menu would appear directly beneath the arrow, rather than in the middle of the screen.
Items in the menu shouldn't have a radio button to indicate whether they are selected
Is there a component that is more appropriate for this than Spinner, or should I achieve these goals by tweaking a Spinner?
You should use a ContextMenu to do what you are looking for. In the dev guide there is a page about menus and a section about ContextMenus that will help with the implementation. If you put some time in skinning this menu you can change the look to match what you want.
may be i not getting you but You can use actionsheet which you can handle as you want
Related
I'm building an android game that doesn't have an action bar. Even though I don't have an action bar, I still want the three vertical dots placed somewhere within my app. I'm not sure if I have to create my own image file that contains the dots, or if there's some way to move the dots in the layout manager in eclipse. Then when these dots are selected I want it to do the vertical drop down menu option like it does in the action bar.
Also I want the dots to disappear in android phones running under android 4.0, so that they can just use the normal menu button. Is this possible? It would be even better if I could get the three dots to trigger the menu in phones below 4.0 but I don't think that's possible so I'd rather just hide it entirely.
Thanks.
I'm not sure if I have to create my own image file that contains the dots
The standard overflow icon should be in your SDK.
or if there's some way to move the dots in the layout manager in eclipse
No.
Then when these dots are selected I want it to do the vertical drop down menu option like it does in the action bar.
You are welcome to implement your own PopupMenu for displaying a menu.
Also I want the dots to disappear in android phones running under android 4.0, so that they can just use the normal menu button
You are welcome to call setVisibility() on whatever you are using for your image whenever the mood strikes you. You will also need to arrange to display your own menu for MENU button presses.
IOW, you will need to roll your own menu system: displaying your trigger, displaying the menu based on the trigger, and doing something on menu choice selections. You are welcome to crib bits of this from the AppCompat action bar in the Android Support package, or perhaps ActionBarSherlock, if you wish.
It would be even better if I could get the three dots to trigger the menu in phones below 4.0
Since you are writing it all yourself, you are welcome to have it do whatever you want.
I want to make a action-bar drop-down-menu that shows items (icons) horizontally. Like this:
This is suppose to be a action-bar withe drop-down menu, where you can choose a color.
So it should show the icons (colors) horizontally and the icons should be clickable. Until now I have only managed to make a vertical list.
If possible I would like to do this in XML.
The ActionBar is not designed for such a use-case. The ActionBar buttons are meant to replace the old options menu that could be triggered with a separate hardware button on older devices (pre HC/ICS). The overflow button (the one with the 3 dots) that you've drawn in your sketch is used when there isn't enough room to show all buttons (the Android framework takes care of this automatically), so those will be grouped in the overflow menu. Overriding this behavior is a bad idea (if even possible).
Instead you should consider another approach: Add one ActionButton to the ActionBar that is meant to handle the color chooser. When this button is clicked the best solution is to show an AlertDialog (you can easily insert your on Views here that show the colors you want) because this will work best even if the button is hidden in the overflow menu.
Alternatively you could trigger a PopupMenu or implement some QuickAction to handle the color chooser (this will probably suck if your button is hidden in the overflow menu and will also lead to a very confusing UI).
My need is to add a drop down menu like the one shown in attached image link.
http://i.imgur.com/cWtykfN.jpg
I don't know what to be used, whether it is tabs or menus. My need is when I press the last tab/menu, the sub menu should be shown and I could be able to handle the corresponding actions. Even when I handle those menus, I should be able to show the top tab/ menu without interruption.
It's called as overflow menus. Look this example, you will get an idea.
http://wptrafficanalyzer.in/blog/adding-action-items-and-overflow-menu-items-to-action-bar-in-android/
And nice explanation been given here. http://blog.stylingandroid.com/archives/1249 and for source code.ref here: https://github.com/StylingAndroid/StylingActionBar/Tree/StylingPart2
Use the ActionBar with tab-navigation-mode and if the last tab is clicked you could simply trigger a PopupMenu (even though this seems a little weird and is not what I expect to happen when I click tab).
I'm trying to figure out how to create a User Information dropdown menu exactly like what evernote uses in the screen shot below.
Dropdowns and normal spinners don't seem to support a Header value where the Username is.
Does anyone have any ideas how to to implement something like this with a header, custom fields in the dropdown list and spinner icon in bottom right of header.
Also, the sample at http://developer.android.com/guide/topics/ui/actionbar.html#Dropdown is not what I need unless it can be expanded for header and custom entries.
Supporting Android 3.1+
Here's the screenshot
According to this page: http://developer.android.com/guide/topics/ui/menus.html#context-menu, Contextual Action Mode is preferred when working on Honeycomb or higher. This is actually very useful when you can apply the same kind of action to several items at a time (eg: delete).
But some actions actually only make sense on one item at a time (eg: Edit).
If you have only one of these actions, well, you can simply use the single click for it. So: One click = edit and select multiple items = action mode with actions that apply to many items
An example of that is the Gmail app: one click = read the email and selecting many items, you can mark them as read, delete them, etc.
OK, but what if you have multiple actions that can only a apply to one item at a time? Imagine the following situation.
You have a list of profiles.You can do the following actions on the profiles:
delete
export (save in a file)
share
These actions could be applied to many items at a time, so you place them in the action mode. But other actions could be:
edit
apply
You can only edit or apply one profile at a time.
So, in that case, is it OK to continue using floating menus like this:
One single click or long-click opens a floating menu with available options on that particular item alone (edit, apply, delete, export, share).
Selecting multiple items activates the action mode with actions that apply to all the selected items (delete, export, share)
Or maybe is it better to keep using action mode only?
When one item is selected, all actions are available (edit, apply, delete, export, share)
When more than one item are selected, the actions edit and apply are disabled/removed from the action bar.
Both methods can work of course and it could be up to the developer to choose but what would be best practice or the best approach to be more user-friendly?
Thanks!!
In GMail, you can also star as well as read on clicking on one item. This is achieved by putting buttons into each row (a star).