Reputation: 50392
I want to have a view with several choices when I click an element of my ListView. I was thinking of implementing an AlertDialog but as I need more than 3 options it is not possible... I also thought of putting my ListView in a FrameLayout and have an view with a gone visibility that I would turn visible at the click and update the content but I don't know If it's a good idea. I could do with some advice,
Thanks for any idea.
Upvotes: 0
Views: 687
Reputation: 46844
You can create another activity, and give it the dialog theme:
<activity android:theme="@android:style/Theme.Dialog">
This causes it to look like an AlertDialog, but you have full control over what it looks like.
Note that when I used this previously it was rather slow, at least in the emulator though.
Upvotes: 0
Reputation: 26525
You could use ContextMenu
This tutorial may help.
Edit based on the comment:
Hmmm.. Since you want more than 3 options and icons in the menu that's displayed when a item is clicked; you could set an onclicklistener for an item in the list and on clicking switch to an Activity that extends a BaseAdapter along with your own custom layout.
I personally don't recommend this as it could complicate things quite a bit. Context menu is quite straightforward and way to go.
Upvotes: 0
Reputation: 12782
You can use ContextMenu, if dialog works fine for you. If you don't want the dialog then use PopupWindow.
Upvotes: 1