设置ToolBar,隐藏ActionBar
Toolbar toolbar = (Toolbar) findViewById(R.id.toobar);
setSupportActionBar(toolbar);
去除Toolbar自有的Title,在布局中使用app:title=""是不会起作用的,还是会显示ActionBar的标题
getSupportActionBar().setDisplayShowTitleEnabled(false);
toolbar按钮的跳转
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
}
return super.onOptionsItemSelected(item);
}