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

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

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

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

item = item.setOnActionExpandListener(null);
assertThat(item).isNotNull();
item = item.setShortcut('6', 'z');
assertThat(item).isNotNull();
item = item.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public MenuItem setShortcut(char numericChar, char alphaChar) {
  mNativeItem.setShortcut(numericChar, alphaChar);
  return this;
}

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
public MenuItem setShortcut(char numericChar, char alphaChar) {
  mNativeItem.setShortcut(numericChar, alphaChar);
  return this;
}

代码示例来源:origin: qiubiteme/android_api_demos

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  super.onCreateOptionsMenu(menu);
  menu.add(0, COLOR_MENU_ID, 0, "Color").setShortcut('3', 'c');
  menu.add(0, EMBOSS_MENU_ID, 0, "Emboss").setShortcut('4', 's');
  menu.add(0, BLUR_MENU_ID, 0, "Blur").setShortcut('5', 'z');
  menu.add(0, ERASE_MENU_ID, 0, "Erase").setShortcut('5', 'z');
  menu.add(0, SRCATOP_MENU_ID, 0, "SrcATop").setShortcut('5', 'z');
  /****   Is this the mechanism to extend with filter effects?
  Intent intent = new Intent(null, getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(
             Menu.ALTERNATIVE, 0,
             new ComponentName(this, NotesList.class),
             null, intent, 0, null);
  *****/
  return true;
}

代码示例来源:origin: THEONE10211024/ApiDemos

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  super.onCreateOptionsMenu(menu);
  menu.add(0, COLOR_MENU_ID, 0, "Color").setShortcut('3', 'c');
  menu.add(0, EMBOSS_MENU_ID, 0, "Emboss").setShortcut('4', 's');
  menu.add(0, BLUR_MENU_ID, 0, "Blur").setShortcut('5', 'z');
  menu.add(0, ERASE_MENU_ID, 0, "Erase").setShortcut('5', 'z');
  menu.add(0, SRCATOP_MENU_ID, 0, "SrcATop").setShortcut('5', 'z');
  /****   Is this the mechanism to extend with filter effects?
  Intent intent = new Intent(null, getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(
             Menu.ALTERNATIVE, 0,
             new ComponentName(this, NotesList.class),
             null, intent, 0, null);
  *****/
  return true;
}

代码示例来源:origin: ogarcia/opensudoku

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  // This is our one standard application action -- inserting a
  // new note into the list.
  menu.add(0, MENU_ITEM_SAVE, 0, R.string.save)
      .setShortcut('1', 's')
      .setIcon(R.drawable.ic_save);
  menu.add(0, MENU_ITEM_CANCEL, 1, android.R.string.cancel)
      .setShortcut('3', 'c')
      .setIcon(R.drawable.ic_close);
  // Generate any additional actions that can be performed on the
  // overall list.  In a normal install, there are no additional
  // actions found here, but this allows other applications to extend
  // our menu with their own actions.
  Intent intent = new Intent(null, getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0,
      new ComponentName(this, SudokuEditActivity.class), null, intent, 0, null);
  return true;
}

代码示例来源:origin: Wilm0r/giggity

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  super.onCreateOptionsMenu(menu);
  menu.add(Menu.NONE, 1, 5, R.string.settings)
      .setShortcut('0', 's')
      .setIcon(R.drawable.ic_settings_white_24dp)
      .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
  menu.add(Menu.NONE, 2, 7, R.string.add_dialog)
      .setShortcut('0', 'a')
      .setIcon(R.drawable.ic_add_white_24dp)
      .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
  return true;
}

代码示例来源:origin: ogarcia/opensudoku

menu.add(0, MENU_ITEM_FOLDERS, 0, R.string.folders).setShortcut('1', 'f')
    .setIcon(R.drawable.ic_sort);
menu.add(0, MENU_ITEM_FILTER, 1, R.string.filter).setShortcut('1', 'f')
    .setIcon(R.drawable.ic_view);
menu.add(0, MENU_ITEM_INSERT, 2, R.string.add_sudoku).setShortcut('3', 'a')
    .setIcon(R.drawable.ic_add);
menu.add(0, MENU_ITEM_SETTINGS, 2, R.string.settings).setShortcut('4', 's')
    .setIcon(R.drawable.ic_settings);

代码示例来源:origin: ogarcia/opensudoku

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  super.onCreateOptionsMenu(menu);
  // This is our one standard application action -- inserting a
  // new note into the list.
  menu.add(0, MENU_ITEM_ADD, 0, R.string.add_folder)
      .setShortcut('3', 'a')
      .setIcon(R.drawable.ic_add);
  menu.add(0, MENU_ITEM_IMPORT, 0, R.string.import_file)
      .setShortcut('8', 'i')
      .setIcon(R.drawable.ic_cloud_upload);
  menu.add(0, MENU_ITEM_EXPORT_ALL, 1, R.string.export_all_folders)
      .setShortcut('7', 'e')
      .setIcon(R.drawable.ic_share);
  menu.add(0, MENU_ITEM_SETTINGS, 2, R.string.settings)
      .setShortcut('6', 's')
      .setIcon(R.drawable.ic_settings);
  menu.add(0, MENU_ITEM_ABOUT, 2, R.string.about)
      .setShortcut('1', 'h')
      .setIcon(R.drawable.ic_info);
  // Generate any additional actions that can be performed on the
  // overall list.  In a normal install, there are no additional
  // actions found here, but this allows other applications to extend
  // our menu with their own actions.
  Intent intent = new Intent(null, getIntent().getData());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0,
      new ComponentName(this, FolderListActivity.class), null, intent, 0, null);
  return true;
}

代码示例来源:origin: ogarcia/opensudoku

.setShortcut('1', 'u')
.setIcon(R.drawable.ic_undo);
.setShortcut('7', 'r')
.setIcon(R.drawable.ic_restore);
.setShortcut('3', 'a')
.setIcon(R.drawable.ic_delete);
.setShortcut('0', 'h')
.setIcon(R.drawable.ic_help);
.setShortcut('9', 's')
.setIcon(R.drawable.ic_settings);

代码示例来源:origin: openintents/notepad

R.string.menu_insert
);
insertItem.setShortcut('1', 'i');
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
menu.add(0, MENU_SEARCH, 0, R.string.menu_search).setShortcut('2', 's')
    .setIcon(android.R.drawable.ic_menu_search);
    .setShortcut('3', 'o').setIcon(R.drawable.ic_menu_folder);
    .setShortcut('9', 's');

代码示例来源:origin: openintents/notepad

menu.add(5, MENU_SEARCH, 0, R.string.menu_search).setShortcut('3', 'f')
    .setIcon(android.R.drawable.ic_menu_search);
menu.add(0, MENU_REVERT, 0, R.string.menu_revert).setShortcut('0', 'r')
    .setIcon(android.R.drawable.ic_menu_revert);
    .setShortcut('1', 'e').setIcon(android.R.drawable.ic_lock_lock); // TODO:
    .setShortcut('1', 'e').setIcon(android.R.drawable.ic_lock_lock); // TODO:
item.setIcon(android.R.drawable.ic_menu_delete);
menu.add(2, MENU_IMPORT, 0, R.string.menu_import).setShortcut('1', 'i')
    .setIcon(android.R.drawable.ic_menu_add);
menu.add(2, MENU_SAVE, 0, R.string.menu_save).setShortcut('2', 's')
    .setIcon(android.R.drawable.ic_menu_save);
    .setShortcut('3', 'w').setIcon(android.R.drawable.ic_menu_save);
    .setShortcut('4', 't');
    .setShortcut('9', 'p');

代码示例来源:origin: openintents/notepad

items[0].setShortcut('1', 'e');

相关文章