0

I am using a DrawerLayout and the ActionBarDrawerToggle to allow the user to open it by tapping the "hamburger" icon.

I have now added in a Bottm Sheet, using a third party library (as no offical support exists) but I still want to use the design guidelines written for Bottom Sheets. This means I should really change the hamburger icon to be an "X" so it can be closed by tapping it (as well as swiping down ot in the content area)

So, how can I dynamically change the hamburger icon to an X (preferably animated) and then back to the hamburger again when the bottom sheet is closed?

I tried the following, but it didn't work:

mDrawerToggle.setHomeAsUpIndicator(R.drawable.ic_clear_white_24dp);
Mr Pablo
  • 4,109
  • 8
  • 51
  • 104

1 Answers1

0

This might work:

mDrawerToggle.setHomeAsUpIndicator(R.drawable.ic_clear);
mDrawerToggle.setDrawerIndicatorEnabled(false);

(or maybe the other way round)

To get back to the original indicator, just call

mDrawerToggle.setDrawerIndicatorEnabled(true);
natario
  • 24,954
  • 17
  • 88
  • 158