0

我是 Android 开发的新手。我想让抽屉在用户登录时显示并用于导航,但在用户注销时隐藏。如何才能做到这一点?它当前设置为关闭抽屉并将侦听器设置为 null,但这只是将切换按钮更改为箭头。谢谢!

DrawerLayout drawer = (DrawerLayout) this.findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
        this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
drawer.setDrawerListener(null);
drawer.closeDrawer(Gravity.LEFT); 
4

1 回答 1

3

在进一步检查后,以下允许我隐藏 ActionBarDrawerToggle:

toolbar.setNavigationIcon(null); 
于 2015-11-12T08:08:52.473 回答