本文整理了Java中android.view.ContextMenu.size()
方法的一些代码示例,展示了ContextMenu.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ContextMenu.size()
方法的具体详情如下:
包路径:android.view.ContextMenu
类名称:ContextMenu
方法名:size
暂无
代码示例来源:origin: k9mail/k-9
for (int i = 0; i < menu.size(); i++) {
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: 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: 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
@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.add(Menu.NONE,i,i,menuitems[i]);
for (int i=0;i<menu.size();i++){
menu.getItem(i).setOnMenuItemClickListener(new OnMenuItemClickListener() {
代码示例来源:origin: PeterCxy/Shelter
if (menu.size() > 0) {
内容来源于网络,如有侵权,请联系作者删除!