android.view.MenuItem.getMenuInfo()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(256)

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

暂无

代码示例

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

@Override
public boolean onContextItemSelected(MenuItem item) {
  AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
  int index = info.position;
}

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

@Override
public boolean onContextItemSelected(MenuItem item) {
  AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
  int index = info.position;
  View view = info.targetView;
}

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

AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch(item.getItemId()) {
  case R.id.add:

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

(ExpandableListContextMenuInfo) menuItem.getMenuInfo();

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

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
  super.onCreateContextMenu(menu, v, menuInfo);
  AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
  String title = ((MyItem) mAdapter.getItem(info.position)).getTitle();
  menu.setHeaderTitle(title);

  menu.add(Menu.NONE, MENU_CONTEXT_DELETE_ID, Menu.NONE, DELETE_TEXT);
}

@Override
public boolean onContextItemSelected(MenuItem item) {
  switch (item.getItemId()) {
  case MENU_CONTEXT_DELETE_ID:
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    Log.d(TAG, "removing item pos=" + info.position);
    mAdapter.remove(info.position);
    return true;
  default:
    return super.onContextItemSelected(item);
  }
}

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

@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
  AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo)item.getMenuInfo();
  int id = item.getItemId();
  if (id == R.id.edit) {

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

AdapterView.AdapterContextMenuInfo info;
try {
  info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
} catch (ClassCastException e) {
  Log.e("", "bad menuInfo", e);

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

@Override
public boolean onContextItemSelected(MenuItem item) {
  AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
  int index = info.position;
}

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

@Override
public boolean onContextItemSelected(MenuItem item) {
  AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
  int index = info.position;
  View view = info.targetView;
}

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

@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
  AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo)item.getMenuInfo();

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

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
  super.onCreateContextMenu(menu, v, menuInfo);

  MenuInflater inflater = this.getActivity().getMenuInflater();
  inflater.inflate(R.menu.my_context_menu, menu);
}

@Override
public boolean onContextItemSelected(MenuItem item) {

  AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
  switch (item.getItemId()) {

    case R.id.add: // <-- your custom menu item id here
      // do something here
      return true;

    default:
      return super.onContextItemSelected(item);
  }
}

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

@Override
public void onCreate(Bundle savedInstanceState) {
  listView = (ListView) findViewById(R.id.your_list_view);
  registerForContextMenu(listView);
}

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

@Override
public boolean onContextItemSelected(MenuItem item) {
  AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();

  switch (item.getItemId()) {
  case R.id.some_item:
    // do something useful
    return true;
  default:
    return super.onContextItemSelected(item);
  }

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

@Override
 public boolean onContextItemSelected(MenuItem item) {
 AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
 int position = info.position;
 deletefunc(position);
 return true;
 }

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

@Override
public boolean onContextItemSelected(MenuItem item) {
  AdapterView.AdapterContextMenuInfo info = 
    (AdapterView.AdapterContextMenuInfo)item.getMenuInfo();

      Track track = (Track)mAdapter.getItem(info.position);

代码示例来源:origin: ukanth/afwall

@Override
public boolean onContextItemSelected(MenuItem item) {
  int itemId = item.getItemId();
  AdapterView.AdapterContextMenuInfo aInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
  String profileName = profilesList.get(aInfo.position).getName();
  switch (itemId) {

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

@Override
 public boolean onContextItemSelected(MenuItem item) {
   ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo();
   int menuItemIndex = item.getItemId();
 }

代码示例来源:origin: pires/android-obd-reader

public boolean onContextItemSelected(MenuItem item) {
  // get index of currently selected row
  AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
  selectedRow = (int) info.id;
  switch (item.getItemId()) {
    case R.id.itemDelete:
      showDialog(ConfirmDialog.DIALOG_CONFIRM_DELETE_ID);
      return true;
    default:
      return super.onContextItemSelected(item);
  }
}

代码示例来源:origin: BoBoMEe/Android-Demos

@Override public boolean onContextItemSelected(MenuItem item) {
 switch (item.getItemId()) {
  case DELETE_ID:
   AdapterView.AdapterContextMenuInfo info =
     (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
   Uri uri = Uri.parse(TodoProvider.CONTENT_URI + "/" + info.id);
   getContentResolver().delete(uri, null, null);
   fillData();
   return true;
 }
 return super.onContextItemSelected(item);
}

代码示例来源:origin: huangfangyi/FanXin

@Override
public boolean onContextItemSelected(MenuItem item) {
  if (item.getItemId() == R.id.remove) {
    final String tobeRemoveUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
    // remove user out from blacklist
    removeOutBlacklist(tobeRemoveUser);
    return true;
  }
  return super.onContextItemSelected(item);
}

代码示例来源:origin: renyuneyun/Easer

@Override
public boolean onContextItemSelected(MenuItem item) {
  AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
  ListDataWrapper wrapper = (ListDataWrapper) getListView().getItemAtPosition(info.position);
  String name = wrapper.name;
  int id = item.getItemId();
  if (id == R.id.action_trigger_profile) {
    loadProfileJobWrapper.triggerProfile(name);
    return true;
  } else
    return super.onContextItemSelected(item);
}

相关文章