List of usage examples for android.view MenuItem setShowAsAction
public void setShowAsAction(int actionEnum);
From source file:com.willyan.viewpagerslideanimation.ScreenSlideActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu_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 ava 2 s. c o m*/ }
From source file:com.thesis.asa.mainui.MainSlideActivity.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(pager.getCurrentItem() > 0); MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (pager.getCurrentItem() == pagerAdapter.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;/*ww w .jav a 2 s . com*/ }
From source file:org.catnut.fragment.TimelineFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.add(Menu.NONE, R.id.refresh, Menu.NONE, R.string.refresh) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // prefer actionbar refresh menu.add(Menu.NONE, R.id.action_back_top, Menu.NONE, getString(R.string.back_to_top)) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // ??//from w ww . j a v a 2 s.c o m MenuItem search = menu.add(android.R.string.search_go); search.setIcon(R.drawable.ic_title_search_default); search.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); mSearchView = VividSearchView.getSearchView(getActivity()); mSearchView.setOnQueryTextListener(this); mSearchView.setOnCloseListener(this); search.setActionView(mSearchView); }
From source file:com.example.google.location.LocationActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem menuItem = menu.add(R.string.clear_map); menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override//from w w w.j av a 2 s . c om public boolean onMenuItemClick(MenuItem item) { clearMap(); return true; } }); return true; }
From source file:android.example.com.animationdemos.CardFlipActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Add either a "photo" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE, mShowingBack ? R.string.action_photo : R.string.action_info); item.setIcon(mShowingBack ? R.drawable.ic_action_photo : R.drawable.ic_action_info); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true;//www . j a v a 2s . co m }
From source file:com.zyq.uitoucheventtest.animator.CardFlipActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Add either a "photo" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE, mShowingBack ? R.string.action_photo : R.string.action_info); item.setIcon(mShowingBack ? R.mipmap.ic_action_photo : R.mipmap.ic_action_info); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true;/*from w ww .j a v a2 s.c o m*/ }
From source file:cn.androidy.materialdesignsample.animations.CardFlipActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Add either a "photo" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE, mShowingBack ? R.string.action_photo : R.string.action_info); item.setIcon(mShowingBack ? R.drawable.ic_action_photo : R.drawable.ic_action_info); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true;/*from ww w . jav a2s . c o m*/ }
From source file:com.example.cardflipanimation.CardFlipActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Add either a "photo" or "finish" button to the action bar, depending // on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE, mShowingBack ? R.string.action_photo : R.string.action_info); item.setIcon(mShowingBack ? R.drawable.ic_action_photo : R.drawable.ic_action_info); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true;//from w w w . java 2 s .c o m }
From source file:de.stadtrallye.rallyesoft.fragments.TasksOverviewFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem refreshMenuItem = menu.add(Menu.NONE, R.id.refresh_menu, 30, R.string.refresh); refreshMenuItem.setIcon(R.drawable.ic_refresh_light); refreshMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); MenuItem resize = menu.add(Menu.NONE, R.id.resize_menu, 40, R.string.resize); resize.setIcon(R.drawable.ic_center_light); resize.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); }
From source file:cf.obsessiveorange.rhcareerfairlayout.ui.fragments.VPFiltersFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); MenuItem searchBtn = menu.findItem(R.id.action_search); searchBtn.setVisible(false);/*from w ww.j a va 2 s .c o m*/ ((MainActivity) getActivity()).closeSearch(); MenuItem clearFiltersItem = menu.add(getResources().getString(R.string.btn_clear_filters)); clearFiltersItem.setIcon(new IconDrawable(this.getActivity(), Iconify.IconValue.fa_times) .colorRes(R.color.accentNoTransparency).actionBarSize()); clearFiltersItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); clearFiltersItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Toast.makeText(getActivity(), "Filters cleared", Toast.LENGTH_SHORT).show(); try { DBManager.setAllCategoriesSelected(false); } catch (SQLException e) { e.printStackTrace(); } ((FiltersCellAdapter) recyclerView.getAdapter()).refreshData(); synchronized (RHCareerFairLayout.refreshCompaniesNotifier) { RHCareerFairLayout.refreshCompaniesNotifier.notifyChanged(); } getActivity().runOnUiThread(new Runnable() { @Override public void run() { recyclerView.getAdapter().notifyDataSetChanged(); } }); return true; } }); }