GuiceU
GuiceU

Reputation: 1038

Add "menu" on every listview item

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: https://i.sstatic.net/y7LhJ.jpg

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?

Upvotes: 27

Views: 14775

Answers (2)

codeMagic
codeMagic

Reputation: 44571

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

Upvotes: 16

Matt
Matt

Reputation: 186

I believe what you are looking for is a Popup Menu

Upvotes: 4

Related Questions