我使用的是新的 DrawerLayout
有边导航。我使用的是抽屉图标('汉堡包')是这样的:
I'm using the new DrawerLayout
to have side navigation. I'm using the drawer icon (the 'hamburger') like this:
@Override
protected void onStart() {
super.onStart();
mDrawerLayout = (DrawerLayout) findViewById(R.id.activity_main_drawerlayout);
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
R.drawable.ic_navigation_drawer,
R.string.app_name,
R.string.app_name);
mDrawerLayout.setDrawerListener(mDrawerToggle);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
}
然而,当我添加了一个片段
的backstack,我要再次显示后退箭头,这样用户可以导航回家,才把打开应用程序的抽屉。
However, when I add a Fragment
to the backstack, I want to display the back arrow again, so the user can navigate back to "home", and only then open the app drawer.
我如何重置抽屉图标后面的图标? 箭头我想要的:
How can I reset the drawer icon to the back icon? The arrow I want:
要关闭并隐藏DrawerToggle汉堡包,只需拨打
To disable and hide the DrawerToggle "Hamburger", just call
mDrawerToggle.setDrawerIndicatorEnabled(false);