Java Code Examples for android.widget.Toolbar#inflateMenu()
The following examples show how to use
android.widget.Toolbar#inflateMenu() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RssfeedActivity.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { Toolbar tb = (Toolbar) findViewById(R.id.toolbar); tb.inflateMenu(R.menu.mainmenu); tb.setOnMenuItemClickListener( new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { return onOptionsItemSelected(item); } }); return true; }
Example 2
Source File: MenuBindingAdapter.java From deagle with Apache License 2.0 | 5 votes |
@BindingAdapter("menu") public static void inflateMenu(final Toolbar toolbar, final @MenuRes int old_menu, final @MenuRes int new_menu) { if (SDK_INT < LOLLIPOP) return; if (new_menu == old_menu) return; final Menu menu = toolbar.getMenu(); menu.clear(); toolbar.inflateMenu(new_menu); }