List of usage examples for android.view MenuItem setShowAsAction
public void setShowAsAction(int actionEnum);
From source file:com.example.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_previous, Menu.NONE, (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? "Finalizar" : "Siguiente"); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true;//from w w w . j a va2 s.c o m }
From source file:org.deviceconnect.android.deviceplugin.irkit.settings.fragment.IRKitRegisterIRFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { final MenuItem menuItem = menu.add(getString(R.string.menu_close)); menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override//from w w w. ja v a2 s .c om public boolean onMenuItemClick(final MenuItem item) { if (item.getTitle().equals(menuItem.getTitle())) { getActivity().finish(); } return true; } }); }
From source file:org.strongswan.android.ui.TrustedCertificateListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item = menu.add(R.string.search); item.setIcon(android.R.drawable.ic_menu_search); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); SearchView sv = new SearchView(getActivity()); sv.setOnQueryTextListener(this); item.setActionView(sv);/* w w w. j av a 2 s. c o m*/ }
From source file:com.darsihmad.slideScreen.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); 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 . ja v a2s . c o m }
From source file:org.catnut.fragment.OAuthFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem refresh = menu.add(Menu.NONE, R.id.refresh, Menu.NONE, getString(R.string.refresh)); refresh.setIcon(R.drawable.ic_action_retry); refresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); }
From source file:com.zbrown.droidsteal.activities.HijackActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem menu0 = menu.add(0, 0, 0, getString(R.string.back)); menu0.setIcon(R.drawable.ic_action_back); menu0.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); MenuItem menu1 = menu.add(0, 1, 0, getString(R.string.forward)); menu1.setIcon(R.drawable.ic_action_forward); menu1.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); MenuItem menu2 = menu.add(0, 2, 0, getString(R.string.reload)); menu2.setIcon(R.drawable.ic_action_refresh); menu2.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(0, 3, 0, getString(R.string.changeurl)); menu.add(0, 4, 0, getString(R.string.close)); return true;/*from ww w. ja va 2 s .c o m*/ }
From source file:th.in.ffc.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem whatnew = menu.add(Menu.NONE, R.layout.whatnew_dialog, Menu.NONE, "what new"); whatnew.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); SharedPreferences sp = getSharedPreferences(FamilyFolderCollector.TAG, MODE_PRIVATE); int prev = sp.getInt(FamilyFolderCollector.PREF_VERSION, 0); int now = getResources().getInteger(R.integer.version_code); whatnew.setIcon((now > prev) ? R.drawable.ic_action_star : R.drawable.ic_action_start_dark); return super.onCreateOptionsMenu(menu); }
From source file:com.misczak.joinmybridge.EventFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item = menu.add("Search"); item.setIcon(R.drawable.ic_search_white_24dp); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); mSearchView = new MySearchView(getActivity()); mSearchView.setOnQueryTextListener(this); mSearchView.setOnCloseListener(this); mSearchView.setIconifiedByDefault(true); item.setActionView(mSearchView);/*from www. j a v a 2s. c om*/ }
From source file:org.chromium.chrome.browser.preferences.Preferences.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { if (menu.size() == 1) { MenuItem item = menu.getItem(0); if (item.getIcon() != null) item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }//ww w . j a va2 s. c om return super.onPrepareOptionsMenu(menu); }
From source file:org.strongswan.android.ui.SelectedApplicationsListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item = menu.add(R.string.search); item.setIcon(android.R.drawable.ic_menu_search); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); SearchView sv = new SearchView(getActivity()); sv.setOnQueryTextListener(this); item.setActionView(sv);/*from www . j a v a 2 s.co m*/ super.onCreateOptionsMenu(menu, inflater); }