更改抽屉图标背靠背箭头箭头、抽屉、图标

2023-09-05 06:23:04 作者:法海你不懂爱。

我使用的是新的 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);
 
精彩推荐
图片推荐