I have created a custom ContextMenu
. But when I call the menu, the menu displayed also h开发者_StackOverflow社区as the default menu.
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);
}
精彩评论