I have a GridView with some items and when the user clicks on an item, I show a DialogFragment with all the item details. I wanted to know if there is a way to create my own dropdown menu like the ones in the ActionBar. Meaning, when the user will click on an ImageButton let's say, I would show all the available actions for this item, like deletion, editing etc.
Any ideas are welcomed.
you could try PopupMenu. PopupMenu could be used to display a custom dropdown menu which could be anchored to a view
https://developer.android.com/reference/android/widget/PopupMenu.html
Related
I want to display popup menu with sub items as shown in the image.
What is the correct approach for this.
The attached UI is the calllog. What i am interested is that how the horizontal menu is implemented. When click on one list item, it appeared in one line under the list item.
In the earlier android, one click on list item, we can use Context menu popup menu to show the available action to do.
I am curious that it is using expandable list view concept?
I want to design like that when click on list item to show like this, but my layout would not be the same as this one. I want to put custom layout depending on the list item type. It may include button, textview, other widgets and the layout height will not be the list item height.
Can someone give some suggestion? Thanks a lot.
I want to have a dropdownlist like this:
But i want to pop it up when you click a menu item. So spinner is not a necessary. Is there a standalone dropdownlist, or is it possible i trigger the spinner automatically?
You can do this a few ways:
Give your item a submenu by putting another <menu> element inside the <item> tag.
Handle the item click yourself and show a ListPopupWindow
Create a DialogFragment. Override onCreateDialog() and use an AlertDialog.Builder to create the dialog. Call one of the variations of setSingleChoiceItems() on the builder to set a list of single choice items to show in the content.
The first method is maybe the easiest since the selection will call back to your onOptionsItemSelected() method and you can easily handle it there, but the other options may be of interest to you as well.
If you want to show a dropdown list on an menu item click, you need to use the Spinner object.
Alternatively you can also use the Action bar with drop-down navigation : http://developer.android.com/guide/topics/ui/actionbar.html#Dropdown
How do you implement a contextual action bar for a custom list view to select multiple list items?
I want my application to be similar to the Contacts application in Samsung Mobiles.
When scrolling through the Contacts List, clicking Menu -> Delete adds checkboxes to each list item and a temporary overlay appears over the actionbar.
Could someone help with some pointers on where to begin with this?
As I'm using custom list using custom layout and adapter, there is no scope to use listview.setChoiceMode();
You must use a contextual menu bar, take a look at these tutorials:
http://wptrafficanalyzer.in/blog/creating-a-contextual-menu-bar-contextual-action-mode-for-a-listview-in-android/#comment-84075
http://androidperspective.wordpress.com/2013/04/17/contextual-action-bar-with-listview/
In my android application I have a list view and some other buttons above the listview. I need to implement the functionality to add the selected item of the listview to my favourites list by creating a menu item.
I can create a menu item to click and add the functionality.
But it should only show the menu item if the focus is on any listview item and not when the focus is on any other button or anyItem. the menu item should only display when the focus is on any listview item and press the menu button.
Can Someone help me please.
Have you considered using a context menu instead of trying to modify the main menu? It seems like behavior might be more in line with the UI guidelines.