Android - Popup menu when list item view pressed?

后端 未结 7 1553
逝去的感伤
逝去的感伤 2020-12-24 15:33

i would like to implement a popup menu similar to google\'s play store as shown below.

\"enter

7条回答
  •  感情败类
    2020-12-24 15:52

    first of all you need to make your custom adapter with a view that has the 3 dots.

    then in the getView() or newView() method you set the listener to the 3 dots image.

    i think that PopupMenu is what you are looking for, it's is supported since API 11.

    if you want to support also earlier version of the API you can use PopupMenu class provided by the support library v7.

    the usage is pretty straight forward. you define it with the id of the view you want the menu to show next to, and then you can directly inflate a menu resource there as if it was a common menu.

提交回复
热议问题