开发者

Open Android options menu from method

I know that it's possible because I've done it before, but i los开发者_JAVA百科t my code. I want to open the Menu from an touch event. What do I need to write to open it? I really don't know anymore.


You need to override onCreateContextMenu(ContextMenu, View, ContextMenu.ContextMenuInfo) and onContextItemSelect() in activity.

If you want it to appear on long click then call registerForContextMenu(View). If you want to show it manually on clicking any view then call openContextMenu() in onClick().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜