List of usage examples for android.view MenuItem setShowAsAction
public void setShowAsAction(int actionEnum);
From source file:org.epstudios.epcoding.ScreenSlideActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.activity_screen_slide, menu); menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0); // Add either a "next" or "finish" button to the action bar, depending // on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish : R.string.action_next); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true;/*w ww . j a va2s .c o m*/ }
From source file:com.example.shiwangi.dataplan.ScreenSlideActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.activity_screen_slide, menu); menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0); // Add either a "next" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish : R.string.action_next); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true;/* w w w .j a v a 2s . c o m*/ }
From source file:ro.expectations.expenses.ui.categories.EditCategoryFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item = menu.add(Menu.NONE, R.id.action_save, Menu.NONE, R.string.action_save); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); item.setIcon(DrawableHelper.tint(getActivity(), R.drawable.ic_done_black_24dp, R.color.colorWhite)); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.examples.abelanav2.ui.UploadFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem uploadMenu = menu.add(R.string.upload_menu_action); uploadMenu.setIcon(R.drawable.ic_done_white_24dp); uploadMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); uploadMenu.setOnMenuItemClickListener(this); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.keithcassidy.finishline.LineCrossingsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem clearListMenuItem = menu.add(R.string.menu_clear_crossing_times); clearListMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); clearListMenuItem.setIcon(android.R.drawable.ic_menu_delete); clearListMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override/*from w w w .j a v a 2s .c o m*/ public boolean onMenuItemClick(MenuItem item) { try { deleteCrossings(); } catch (Exception e) { Log.e(TAG, "onMenuItemClick " + e); } return true; } }); MenuItem shareMenuItem = menu.add(R.string.menu_share); shareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); shareMenuItem.setIcon(android.R.drawable.ic_menu_share); shareMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { try { sendCurrentCrossing(); } catch (Exception e) { Log.e(TAG, "onMenuItemClick " + e); } return true; } }); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.mifos.mifosxdroid.online.DocumentListFragment.java
@SuppressWarnings("deprecation") @Override//from ww w .j ava 2 s. c om public void onPrepareOptionsMenu(Menu menu) { menu.clear(); MenuItem menuItemAddNewDocument = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_DOCUMENT, Menu.NONE, getString(R.string.add_new)); menuItemAddNewDocument.setIcon(getResources().getDrawable(R.drawable.ic_action_content_new)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) menuItemAddNewDocument.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); super.onPrepareOptionsMenu(menu); }
From source file:com.mifos.mifosxdroid.online.DataTableDataFragment.java
@SuppressWarnings("deprecation") @Override//from w w w . j a va2 s. c o m public void onPrepareOptionsMenu(Menu menu) { menu.clear(); MenuItem menuItemAddNewEntryToDataTable = menu.add(Menu.NONE, MEUN_ITEM_ADD_NEW_ENTRY, Menu.NONE, getString(R.string.add_new)); menuItemAddNewEntryToDataTable.setIcon(getResources().getDrawable(R.drawable.ic_action_content_new)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { menuItemAddNewEntryToDataTable.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } super.onPrepareOptionsMenu(menu); }
From source file:tw.com.geminihsu.app01.fragment.Fragment_OrderFilter.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item = menu.add(Menu.NONE, ACTIONBAR_MENU_ITEM_FINISH, Menu.NONE, getString(R.string.btn_finish)); SpannableString spanString = new SpannableString(item.getTitle().toString()); spanString.setSpan(new ForegroundColorSpan(Color.WHITE), 0, spanString.length(), 0); //fix the color to white item.setTitle(spanString);/*from w w w. j a v a2 s . c om*/ item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.example.shyam.popi.LearnEmotions.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); setVolumeControlStream(AudioManager.STREAM_MUSIC); getMenuInflater().inflate(R.menu.activity_screen_slide, menu); menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0); // Add either a "next" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish : R.string.action_next); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true;//from w w w.ja v a 2 s . c o m }
From source file:com.duy.pascal.ui.file.FileExplorerAction.java
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { menu.add(0, R.id.select_all, 0, R.string.select_all).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0, R.id.cut, 0, R.string.cut).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(0, R.id.copy, 0, R.string.copy).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem pasteMenu = menu.add(0, R.id.paste, 0, R.string.paste); pasteMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); pasteMenu.setEnabled(mFileClipboard.canPaste()); mRenameMenu = menu.add(0, R.id.rename, 0, R.string.rename); mRenameMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); mShareMenu = menu.add(0, R.id.share, 0, R.string.share); mShareMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); mShareActionProvider = new ShareActionProvider(mContext); mShareActionProvider.setOnShareTargetSelectedListener(this); MenuItemCompat.setActionProvider(mShareMenu, mShareActionProvider); menu.add(0, R.id.delete, 0, R.string.delete).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); return true;// w ww.j a va 2 s .co m }