我是 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);