Im currently messing arround with the new AppCompat library bringing material design to older devices.
Setting a toolbar as actionbar works fine for me, but the tool
If you are calling setSupportActionBar()
you don't need to use toolbar.inflateMenu()
because the Toolbar is acting as your ActionBar. All menu related callbacks are via the default ones. The only time you need to call toolbar.inflateMenu()
is when you are using the Toolbar as a standalone widget. In this case you will also have to handle menu item click events via
toolbar.setOnMenuItemClickListener(
new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
// Handle menu item click event
return true;
}
});