开发者

Why ContextMenu is not visible in Android Emulator?

开发者 https://www.devze.com 2023-03-08 17:31 出处:网络
Hello I have a problem in show a context menu. I have this methods to implement my menu: public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo)

Hello I have a problem in show a context menu. I have this methods to implement my menu:

public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo)
public boolean onContextItemSelecte开发者_如何学编程d(MenuItem item)

But when I run the emulator and holds the Menu key, I don't see my context menu. I am using a simple layout, without listviews. I dont understand what view I can choose to register my context menu.

Anyone can explain me this better?


if you want create menu then follow this link. and Menu and ContextMenu both are diffrent in android.. menu is open on menu button of device and contextmenu is open in widget like as on listview,textview...etc


You need to call registerForContextMenu(View v) and pass in your layout view as the parameter.

0

精彩评论

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