You can use the toolbar as Stand Alone mode, that means you should not use your toolbar as part of your ActionBarDrawerToggle constructor, you can achieve that using the below code:
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, null,
R.drawable.appbar, R.drawable.appbar)
(Note how the toolbar instance is not being sent to the ActionBarDrawerToggle constructor)
Also, you should inflate your menu manually
mToolbar = (Toolbar) findViewById(R.id.nav_toolbar);
mToolbar.inflateMenu(R.menu.base);
And remove the setSupportActionBar(mToolbar); line of code.
Of course, you will have to handle the navigation click by yourself:
mToolbar.setOnMenuItemClickListener(new OnMenuItemClickListener() ...
Then, you can open your drawer like this:
drawerButton = (BadgeDrawerButton) findViewById(R.id.badge_drawer_button);
drawerButton.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
mDrawerLayout.openDrawer(Gravity.LEFT);
}
});
Hope this may help.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…