List of usage examples for android.view MenuItem setShowAsAction
public void setShowAsAction(int actionEnum);
From source file:net.sakuramilk.kbcupdater.MainFragmentActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add("Update list"); MenuItem actionItem = menu.add("Update list"); actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); actionItem.setIcon(android.R.drawable.ic_menu_manage); return true;/*from www. j a v a 2 s . c om*/ }
From source file:se.chalmers.watchme.activity.TagMovieListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); /*/* w w w. jav a 2 s. c o m*/ * It should not be possible to mail or sort in this activity */ MenuItem mailItem = menu.findItem(R.id.menu_send_email_button); mailItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem sortItem = menu.findItem(R.id.menu_sort_button); sortItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); /* * Add necessary functionality for the search widget */ SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search_button).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; // expand it by default return true; }
From source file:se.chalmers.watchme.activity.SearchableActivity.java
public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); /*//from w w w. ja va2 s. c o m * It should not be possible to mail or sort in this activity */ MenuItem mailItem = menu.findItem(R.id.menu_send_email_button); mailItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem sortItem = menu.findItem(R.id.menu_sort_button); sortItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); /* * Add necessary functionality for the search widget */ SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search_button).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; // expand it by default return true; }
From source file:jp.morimotor.beaconattend.HelpActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // ?????//from ww w .j a v a 2s . c o m MenuItem actionItem = menu.add("infoButton"); // SHOW_AS_ACTION_IF_ROOM:??? actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); // actionItem.setIcon(R.drawable.ic_info_outline_white_24dp); return true; }
From source file:com.example.ward.view.CursorFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // Place an action bar item for searching. MenuItem item = menu.add("Search"); item.setIcon(android.R.drawable.ic_menu_search); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); SearchView sv = new SearchView(getActivity()); sv.setOnQueryTextListener(this); item.setActionView(sv);/*w w w . ja v a2s. c o m*/ }
From source file:com.money.manager.ex.search.SearchActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); UIHelper ui = new UIHelper(this); // Add Search icon. getMenuInflater().inflate(R.menu.menu_search, menu); MenuItem item = menu.findItem(R.id.searchMenuItem); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); item.setIcon(ui.getIcon(GoogleMaterial.Icon.gmd_search)); // show this menu item last return true;/* w ww. java2 s.co m*/ }
From source file:finalproject.ece558.edu.pdx.ece.brailleblackjack.LearnBrailleActivity.java
/** * Create the action menu to provide buttons to navigate the Pager * @param menu Menu object/*w w w . ja v a 2 s .c o m*/ * @return Boolean true */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu_main, menu); // Add/enable previous button depending on which page is active // is currently selected. MenuItem prev_item = menu.add(Menu.NONE, R.id.action_previous, Menu.NONE, R.string.action_previous); prev_item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0); // Add either a "next" or "finished" button to the action bar, depending on which page // is currently active. MenuItem next_item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish : R.string.action_next); next_item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.findItem(R.id.action_next).setEnabled(!(mPager.getCurrentItem() == 3)); menu.findItem(R.id.action_next).setEnabled(mPager.getCurrentItem() < 3); return true; }
From source file:org.aakashlabs.arthashastra.Advanced_Activity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.home_, menu); // Updating score and making sure it's shown in the action bar MenuItem score_keeper = menu.add(Integer.toString(get_score())); score_keeper.setShowAsAction(2); return true;/*from w w w .j a v a 2 s . c o m*/ }
From source file:se.chalmers.watchme.ui.TagListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { /*/*from w ww . j a va 2s .co m*/ * It should not be possible to mail or sort in this fragment */ MenuItem mailItem = menu.findItem(R.id.menu_send_email_button); MenuItem sortItem = menu.findItem(R.id.menu_sort_button); mailItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); sortItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); super.onCreateOptionsMenu(menu, inflater); }
From source file:net.lacolaco.smileessence.activity.EditCommandActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem allOn = menu.add(Menu.NONE, R.id.menu_edit_command_all_on, Menu.NONE, ""); allOn.setTitle(R.string.actionbar_edit_command_all_on); allOn.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true;/*from ww w.ja v a 2 s . c o m*/ }