androidnavigation-drawermaterialdrawer

Android Use MaterialDrawer(Library) with FlowingDrawer(Library)


Before we begin, it would be better to take a look at those two libraries

MaterialDrawer - https://github.com/mikepenz/MaterialDrawer

FlowingDrawer - https://github.com/mxn21/FlowingDrawer

I'm currently using MaterialDrawer. Witch allows me super fast drawer implementation, maintaining, ect..

for that reason i cant give up this library, still i'd love to use FlowingDrawer which provides super cool drawer effect.

i came up with 2 possible options.

  1. export View from MaterialDrawer, insert this into FlowingDrawer.
  2. editing the MaterialDrawer's code to be implemented by FlowingDrawer.

i'm not even sure if both suggestions would work.

tell me your thoughts! better if solution.


Solution

  • The MaterialDrawer requires a DrawerLayout. The FlowingDrawer implements no DrawerLayout thus it is not possible. Modifying the MaterialDrawer's code sounds like a huge effort as the methods of and functions of the DrawerLayout are used in many different places.

    My suggestion would be to use the View the MaterialDrawer generates. Have a look at the EmbeddedDrawerActivity which actually does exactly this. It creates the MaterialDrawer and then uses the View of it and adds it to the root.

    result = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(toolbar)
            .withTranslucentStatusBar(false)
            .withAccountHeader(headerResult)
            .addDrawerItems(
                ...
            )
            .withSavedInstance(savedInstanceState)
            .buildView();
    
    View drawerView = result.getSlider();