关于Toolbar使用时遇到的问题
- 设置Toolbar标题后不显示
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
toolbar.setTitle("练手Demo");
*设置setNavigationIcon图标不生效
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, 0, 0); drawerToggle.syncState(); toolbar.setNavigationIcon(R.mipmap.ic_launcher);
- 不拦截监听事件
对drawlayout中的空间设置事件监听