I have already looked at how to highlight a menu item on selection? and I am also using Android Action Bar Style Generator. They are both essentially saying the same thing, from what I can tell. And neither does what I need. When I click on a menuItem. I want the item to remain highlight, until I click another one which would in turn become highlighted. How do I do that? I have even tried enabling a menuItem but seems to have no effect either. There seems to be no option to set a menu item as selected or focussed. So does anyone know how I might do this?
Related
everyone! I have question for Android guys. Any help or suggestion will be appreciated.
So my problem:
I have application with ActionBarCompat and in this action bar I have a lot of different hiden menu items, which appear only if user click on menu button at action bar. Also I have couple menu items at action bar, which always visible.
I need some customization for one of visible menu item. When user click on this menu item (let's say it would be "Add new" menu item), I need to show different menu in this case. And if user click on standart menu item, it should act like usually.
So I really confused. And I have no idea how I can do it. Maybe someone had the same problem or similar. Thank you!
Screenshot for better understanding:
I am using Action bar and having menu items implemented using Action Provider. Clicking on menu item shows Popup Spinner. Now when any Menu item is clicked and Popup screen is ON and that time - If Overflow menu item is clicked then it doesn't show menu items under Overflow list (I need to click once again to get Overflow menu items).
Is this known issue? Is there any workaround for this?
Is this known issue?
It's known. It is not an issue. The drop-down for list navigation (what I presume the "Popup Spinner" is) has the focus. It takes a tap outside of the drop-down, anywhere in the activity, to dismiss the drop-down.
This is not significantly different than the behavior of a Spinner anywhere else in Android. For example, edit a contact, and tap on the Spinner to change a phone number type (e.g., mobile vs. home vs. work). It takes a tap anywhere else to dismiss the drop-down list, before a tap will have any other meaning.
Is there any workaround for this?
Do not use list navigation or other Spinners in your app.
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'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
I was wondering if it were at all possible to have checkable icons in an action bar in ICS? Not with a check, but with a android:stateChecked property to play around with. I want it so when the user clicks on the icon, they enter a certain mode (and the background of the icon would be a bright color to let them know they are still in that mode), and when they click it again they are taken out of that mode. I've played around with some selector xmls but nothing has worked...Any ideas?
EDIT: I just learned that Checkable items cannot appear in main menus, they can only be in submenus. However, is there a way to still get the behavior of a checkable? It's easy enough to have a boolean like isInModeA, but is there a way to programmatically change the background/icon of an Action bar item?
There is a way to programmatically change the background/icon.
You can use ActionBar.setBackgroundDrawable, for instance, or setCustomView, or setIcon (found on the same page).
You may consider using a dropdown-like ActionProvider to provide e.g. a radio-button-like "on/off" rather than a checkbox.
One approach you could try is to keep the state saved in some variable and just display different items based on this state. Obviously, some of these items can change the state. You might look at doing this by implementing a custom action provider.