The title says it all. When I call the mDrawerToggle.setDrawerIndicatorEnabled(false)
I don\'t want the \"hamburger
\" icon to be shown anymore but
I also face the same problem (it's either the < icon or the menu icon shown, but not both) and finally found what's working for me.
Additional Info : I'm using Support library 25, so it might play a factor in here as I didn't test with previous library version. I'm using Toolbar set as action bar, and set up the ActionDrawerToggle with method that has Toolbar parameter in it. I only tested this on Android M device, though.
The code below is how I enabled/disable the navigation drawer (function is resides in NavigationDrawer Fragment).
public void setDrawerEnabled(final boolean enabled) {
int lockMode = enabled ? DrawerLayout.LOCK_MODE_UNLOCKED :
DrawerLayout.LOCK_MODE_LOCKED_CLOSED;
mDrawerLayout.setDrawerLockMode(lockMode);
mDrawerToggle.setDrawerIndicatorEnabled(enabled);
ActionBar actionBar = null;
if (getActivity() instanceof AppCompatActivity) {
actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
}
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(!enabled);
actionBar.setDefaultDisplayHomeAsUpEnabled(!enabled);
actionBar.setDisplayShowHomeEnabled(enabled);
actionBar.setHomeButtonEnabled(enabled);
}
mDrawerToggle.syncState();
mDrawerToggle.setToolbarNavigationClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!mDrawerToggle.isDrawerIndicatorEnabled())
getActivity().onBackPressed();
}
});
}
In my case, setting the actionBar.setHomeButtonEnabled(enabled);
forces it to draw the menu icon (or else, in my case, when first fragment is resumed, there won't be any navigation icon), although it will stop rendering the < icon for other fragments. Setting the mDrawerToggle.syncState();
after changing the navigation icons remedy that for me, though. Now both icons are shown correctly!
I hope this helps someone!