Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
257 views
in Technique[技术] by (71.8m points)

android - 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: 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...