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

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

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

ContextMenu.getItem介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

android.view.MenuItem item = menu.getItem(i);
  item.setVisible(false);

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

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
  super.onCreateContextMenu(menu, v, menuInfo);
  menu.setHeaderTitle(R.string.menu_title);
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.context_menu, menu);

  // loop for menu items
  for (int i = 0; i < menu.size(); ++i) {
    MenuItem mi = menu.getItem(i);
    // check the Id as you wish
    if (mi.getItemId() == R.id.item2) {
      mi.setChecked(true); 
    }
  }
}

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

public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {   
   menu.add(1, 1, 1, "Share Animal Sound");
   menu.add(1, 2, 2, "Change Picture");
   menu.add(1, 3, 3, "Change Sound");
   menu.getItem(0).setOnMenuItemClickListener(this); 
   menu.getItem(1).setOnMenuItemClickListener(this); 
   menu.getItem(2).setOnMenuItemClickListener(this); 
 }

代码示例来源:origin: derry/delion

private void removeUnsupportedItems(ContextMenu menu, int[] whitelist) {
  Arrays.sort(BASE_WHITELIST);
  Arrays.sort(whitelist);
  for (int i = 0; i < menu.size(); i++) {
    MenuItem item = menu.getItem(i);
    if (Arrays.binarySearch(whitelist, item.getItemId()) < 0
        && Arrays.binarySearch(BASE_WHITELIST, item.getItemId()) < 0) {
      menu.removeItem(item.getItemId());
      i--;
    }
  }
}

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

inflater.inflate(R.menu.activity_1_menu, menu);
menu.getItem(1).setEnabled(menuItem1EnabledState);

代码示例来源:origin: derry/delion

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
  assert mPopulator != null;
  mPopulator.buildContextMenu(menu, v.getContext(), mCurrentContextMenuParams);
  for (int i = 0; i < menu.size(); i++) {
    menu.getItem(i).setOnMenuItemClickListener(this);
  }
}

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

menu.add(1, 2, 1, "Void");
menu.getItem(0).setOnMenuItemClickListener(new OnMenuItemClickListener()
menu.getItem(1).setOnMenuItemClickListener(new OnMenuItemClickListener()

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

menu.add(1, 2, 1, "Void");
menu.getItem(0).setOnMenuItemClickListener(new OnMenuItemClickListener()
menu.getItem(1).setOnMenuItemClickListener(new OnMenuItemClickListener()

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

menu.add(1, 2, 1, "Void");
menu.getItem(0).setOnMenuItemClickListener(new OnMenuItemClickListener()
menu.getItem(1).setOnMenuItemClickListener(new OnMenuItemClickListener()

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

menu.add(1, 2, 1, "Void");
menu.getItem(0).setOnMenuItemClickListener(new OnMenuItemClickListener()
menu.getItem(1).setOnMenuItemClickListener(new OnMenuItemClickListener()

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

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
  super.onCreateContextMenu(menu, v, menuInfo);
  menu.setHeaderTitle(R.string.menu_title);
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.context_menu, menu);

  // loop for menu items
  for (int i = 0; i < menu.size(); ++i) {
    MenuItem mi = menu.getItem(i);
    // check the Id as you wish
    if (mi.getItemId() == R.id.item2) {
      mi.setChecked(true); 
    }
  }
}

    MenuItem mi = menu.findItem(R.id.item2)

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

menu.getItem(i).setOnMenuItemClickListener(new OnMenuItemClickListener() {

相关文章