Search code examples
materialdrawer

MaterialDrawer MiniDrawer hamburger icon


I use MiniDrawer implementation from MaterialDrawer library.

I have tried to add ActionBarDrawerToggle to Drawer but got an Exception. MiniDrawer class does not allow to set ActionBarDrawerToggle

Could you please tell is there way to set hamburger icon on toolbar for MiniDrawer ?


Solution

  • The ActionBarDrawerToggle from Google requires you to use a DrawerLayout in the case of the normal MiniDrawer implementation of the MaterialDrawer there is no DrawerLayout in place, so the default behavior won't work.

    As you still want the hamburger-icon to toggle the Menu state you have to either set the NavigationIcon on your own. Or you check out a library like the following: https://github.com/balysv/material-menu

    This will allow you to have the same animations (and more) as NavigationIcon and forward the open / close events to the Crossfader which is used to have the fading animation from MiniDrawer to normal Drawer size.