ContextMenu initiated from GridView

后端 未结 1 582
南方客
南方客 2021-01-22 14:15

Just wondering if anyone can help with this - I\'m learning and unable to figure it out......

If I register a GridView object with a Context Menu as follows:

<         


        
1条回答
  •  清歌不尽
    2021-01-22 14:24

    In onContextItemSelected() method, you can get the index of the item on the Grid by using:

    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    int index = info.position;
    

    Then use this index for everything you want :)

    0 讨论(0)
提交回复
热议问题