开发者

Default ContextMenu showing up along custom ContextMenu

I have created a custom ContextMenu. But when I call the menu, the menu displayed also h开发者_StackOverflow社区as the default menu.

Is there anyway for the default ContextMenu not to appear as well?

Code requested:

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
{
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = getMenuInflater();
    menu.setHeaderTitle("Recipients");
    inflater.inflate(R.menu.menu_contacts, menu);
}


Context menu is created by overriding onCreateContextMenu method. If you just inflate a menu from resource there no default menu can appear.

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
{
   menu.setHeaderTitle("Context menu");
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.context_menu, menu);
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜