1

I'm using MaterialDrawer library to implement a basic material drawer in my app.

I wasted more than two days trying to figure out how to transform the menu toggle button (burger) to a back button, like Gmail app when you open an email.

In Gmail app when you open an email the menu icon is animated into a back arrow but the menu drawer remains still available.

I've tried to use ValueAnimator to animate the icon as explained here. I've setted an onAnimationEnd listener to replace the menu icon with a working back button:

result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

After doing that the menu drawer slide position get unlinked from the menu drawer icon animation, and when i try to restore the menu drawer button and animate it backwards it gets stuck:

getSupportActionBar().setDisplayHomeAsUpEnabled(false);
result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(true);

Actually a similar question has been already asked, and has been marked has duplicated when it is not: Navigation Drawer with Burger to back arrow animation on Lollipop

Community
  • 1
  • 1
filippo
  • 839
  • 2
  • 13
  • 25
  • Is there any particular reason that you are using this library when the Android support libraries now support this? https://github.com/chrisbanes/cheesesquare – tachyonflux Jun 27 '15 at 22:57
  • because i didn't found anything mentioning the new menudrawer in the android documentation or example projects. Anyway, in this cheesesquare sample when you select a cheese it starts a new activity, and the menu drawer is not accessible anymore – filippo Jun 28 '15 at 08:24
  • Well, I know for a fact that the `ActionBarDrawerToggle` works with the answer here: http://stackoverflow.com/questions/26434504/how-to-implement-drawerarrowtoggle-from-android-appcompat-v7-21-library on the Cheesesquare project – tachyonflux Jun 29 '15 at 02:33

0 Answers0