Android opening context menu after button click

后端 未结 4 1024
余生分开走
余生分开走 2020-12-30 00:16

I want to open context menu when I click a button, but also I have to know which list item is focused when I click the button. Do you know how to do that? What code should b

4条回答
  •  太阳男子
    2020-12-30 01:08

    First of all, you should know why you should use ContextMenu. The functionality of ContextMenu of a View is similar to the right-click menu on a PC, which means the "available operations" on some item.

    According to your description, I think what you actually need is a customized Dialog with a list, which is displayed when clicking the Button and is also able to get the focused item of your ListView. Then you can save the registration of ContextMenu for some View that really needs the menu:)

提交回复
热议问题