I\'m using the new DrawerLayout
to have side navigation. I\'m using the drawer icon (the \'hamburger\') like this:
@Override
protected void onSt
To disable and hide the DrawerToggle "Hamburger", just call
mDrawerToggle.setDrawerIndicatorEnabled(false);
I created an interface for the hosting activity to update the view state of the hamburger menu. For top level fragments I set the toggle to true
and for fragments for which I want to display the up < arrow I set the toggle to false
.
public class SomeFragment extends Fragment {
public interface OnFragmentInteractionListener {
public void showDrawerToggle(boolean showDrawerToggle);
}
private OnFragmentInteractionListener mListener;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
this.mListener = (OnFragmentInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener");
}
}
@Override
public void onResume() {
super.onResume();
mListener.showDrawerToggle(false);
}
}
Then in my Activity ...
public class MainActivity extends Activity implements SomeFragment.OnFragmentInteractionListener {
private ActionBarDrawerToggle mDrawerToggle;
public void showDrawerToggle(boolean showDrawerIndicator) {
mDrawerToggle.setDrawerIndicatorEnabled(showDrawerIndicator);
}
}