Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change drawer icon back to back arrow

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); } 

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:

Navigation Drawer

like image 587
nhaarman Avatar asked Jul 19 '13 15:07

nhaarman


1 Answers

To disable and hide the DrawerToggle "Hamburger", just call

mDrawerToggle.setDrawerIndicatorEnabled(false); 
like image 162
Nipper Avatar answered Nov 04 '22 08:11

Nipper