android.view.ContextMenu.clear()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中android.view.ContextMenu.clear()方法的一些代码示例,展示了ContextMenu.clear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ContextMenu.clear()方法的具体详情如下:
包路径:android.view.ContextMenu
类名称:ContextMenu
方法名:clear

ContextMenu.clear介绍

暂无

代码示例

代码示例来源:origin: neopixl/PixlUI

public void onCreateContextMenu(ContextMenu menu, View v,
                  ContextMenuInfo menuInfo) {
    menu.clear();
  }
});

代码示例来源:origin: stackoverflow.com

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo)
{
  Log.v(TAG, "Creating context menu for view="+view);

  // Clear current contents
  menu.clearHeader();
  menu.clear();

  menu.setHeaderTitle("TEST MENU");
  menu.add(Menu.NONE, Menu.FIRST+1, Menu.NONE, "Test menu");
  super.onCreateContextMenu(menu, view, menuInfo);
}

代码示例来源:origin: stackoverflow.com

@Override
   public void onCreateContextMenu(ContextMenu menu, View v,
       ContextMenuInfo menuInfo)
  {
       AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
       int position = info.position;
       // use this position to decide your item clicked
       menu.clear();
       menu.setHeaderTitle("Context Menu Title");
       String[] menuItems = getResources().getStringArray(
           R.array.menu_context);
       for (int i = 0; i < menuItems.length; i++)
       {
         menu.add(Menu.NONE, i , i, menuItems[i]);
       }
       menu.getItem(0).setEnabled(**Conditional check**);
       menu.getItem(1).setEnabled(**Conditional check**);
       menu.getItem(2).setEnabled(**Conditional check**);
  }

代码示例来源:origin: PrivacyApps/document-viewer

/**
 * {@inheritDoc}
 * 
 * @see android.app.Activity#onCreateContextMenu(android.view.ContextMenu, android.view.View,
 *      android.view.ContextMenu.ContextMenuInfo)
 */
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
  menu.clear();
  menu.setHeaderTitle(R.string.app_name);
  menu.setHeaderIcon(R.drawable.application_icon);
  final MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.mainmenu_context, menu);
  updateMenuItems(menu);
}

代码示例来源:origin: stackoverflow.com

iMenu.clear();
for (int i = 0; i < nTotalTeam; i++) {
  iMenu.add(Menu.NONE, i, Menu.NONE, teamName[i]);

相关文章