27

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.stack.imgur.com/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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
GuiceU
  • 1,030
  • 6
  • 19
  • 35

2 Answers2

16

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

vipul mittal
  • 17,343
  • 3
  • 41
  • 44
codeMagic
  • 44,549
  • 13
  • 77
  • 93
  • Well, one more question. I don't seem to find the overflow icon, neither do i find how to create it somehow in the listview. Do you know how I can do that? Any help would be appreciated. – GuiceU May 07 '13 at 20:42
  • 1
    I had one custom made when we had all of our icons redone but I believe they should be in the `sdk` somewhere. Sorry, I can't tell you where but check [this SO question](http://stackoverflow.com/questions/2687027/standard-android-menu-icons-for-example-refresh) – codeMagic May 07 '13 at 20:49
  • 1
    @GuiceU You can download them here as vector grafics: http://developer.android.com/design/downloads/index.html Just scroll down to the section named "Action Bar Icon Pack" – Terel Mar 08 '14 at 17:29
  • With support lib(v7) you can use PopupMenu for API < 11 – shantanu Apr 25 '15 at 09:19
4

I believe what you are looking for is a Popup Menu

Matt
  • 186
  • 5