@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { mainMenu.performIdentifierAction(subMenu1.getItem().getItemId(), 0); return true; } return super.onKeyUp(keyCode, event); }
@Override public boolean onCreateOptionsMenu(Menu menu) { SubMenu sub = menu.addSubMenu("Theme"); sub.add(0, R.style.Theme_Sherlock, 0, "Default"); sub.add(0, R.style.Theme_Sherlock_Light, 0, "Light"); sub.add(0, R.style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)"); sub.getItem() .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { SubMenu subMenu = menu.addSubMenu(R.string.setting_import); subMenu.add(0, ORDER_DEFAULT, 0, getString(R.string.sort_default)); subMenu.add(0, ORDER_ABC, 0, getString(R.string.sort_abc)); subMenu.add(0, ORDER_TYPE, 0, getString(R.string.sort_type)); subMenu.add(0, ORDER_SIZE, 0, getString(R.string.sort_size)); subMenu .getItem() .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { SubMenu s = menu.addSubMenu(0, MORE_ID, 0, R.string.default_buttons_other_actions); s.add(0, RELOAD_ID, 0, R.string.update_downlod_list); s.add(0, FILTER_EXISTING_REGIONS, 0, R.string.filter_existing_indexes); s.add(0, SELECT_ALL_ID, 0, R.string.select_all); s.add(0, DESELECT_ALL_ID, 0, R.string.deselect_all); s.setIcon( isLightActionBar() ? R.drawable.abs__ic_menu_moreoverflow_holo_light : R.drawable.abs__ic_menu_moreoverflow_holo_dark); s.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { mainMenu = menu; subMenu1 = menu.addSubMenu("Options"); MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.main, subMenu1); MenuItem subMenu1Item = subMenu1.getItem(); subMenu1Item.setIcon(R.drawable.abs__ic_menu_moreoverflow_normal_holo_dark); subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add("Search") .setIcon(R.drawable.ic_action_search) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); SubMenu subMenu1 = menu.addSubMenu("Action Item"); subMenu1.add("My Topics"); subMenu1.add("Review"); subMenu1.add("Config"); MenuItem subMenu1Item = subMenu1.getItem(); subMenu1Item.setIcon(R.drawable.ic_action_options); subMenu1Item.setShowAsAction( MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return super.onCreateOptionsMenu(menu); }
public boolean onCreateOptionsMenu(Menu menu) { SubMenu my_events_submenu = menu.addSubMenu("New Account"); my_events_submenu.add("DropBox").setIcon(R.drawable.dropbox_icon); my_events_submenu.add("Google Drive").setIcon(R.drawable.google_drive_icon); my_events_submenu.add("One Drive").setIcon(R.drawable.skydrive_icon); my_events_submenu.add("Ftp Account").setIcon(R.drawable.ftp_icon); my_events_submenu.add("WebDav"); MenuItem subMenu1Item = my_events_submenu.getItem(); subMenu1Item.setShowAsAction( MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); SubMenu my_account_submenu = menu.addSubMenu("Set Password"); my_account_submenu.add("My Profile"); my_account_submenu.add("Settings"); my_account_submenu.add("Log Out"); return true; }