Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add "menu" on every listview item

Tags:

android

I'm developing this app, which has a listview in it, but I want to add the "three-dot" icon in the corner, and when you press it, an awesome menu will popup. Like this in the Google Play app: http://imgur.com/a/cGb2Q

I've seen many apps that have it, so it could'nt be that hard? I have googled a lot, but to be honest, I don't know really what I should google on. This must probably be the shortest & dumbest question on Stackoverflow, but I didn't really know what my other options was.

I have a thought that it may just be an spinner that somehow is hidden and when you press the three-dot icon it'll just pop up in an awesome way, or is this implemented in the Android SDK?

like image 341
GuiceU Avatar asked May 07 '13 19:05

GuiceU


1 Answers

I don't know how they do it or if this is the best way but you could create the overflow icon (3 dots) and use a PopupMenu for this. This was added in API 11 so it wouldn't work on older versions but if you are targeting API >= 11 then I think this would be a good option for you. I use it in a custom "actionbar".

If this isn't awesome enough for you then you can also use PopupWindow which has been around since API 1

PopupMenu

PopupWindow

like image 182
codeMagic Avatar answered Sep 19 '22 16:09

codeMagic