Materialdrawer: How to use a single drawer for every activity

Created on 22 May 2015  ·  4Comments  ·  Source: mikepenz/MaterialDrawer

I want to use the material drawer in all activities instead of using a fragment based navigation. I explored the samples and I also saw that the library inflates the drawer layout but im not sure how to go about configuring it. What I have done so far is to create a base activity with the drawer then extend other activities from it but when I do the drawer isn't available so can I get some guidance. Thanks.

question

Most helpful comment

@mikepenz But the google io schedule app has drawer in all activities although they finish the activity when you navigate to different screen probably to avoid complexities of back pattern. Google should maintain one valid pattern across all it apps.

@ammar786-1 In case you want the drawer in all activities Follow Google io Schedule app on github. It has a BaseActivity from which all activites extend. Also do make changes like extending AppCompatActivity and themes...

All 4 comments

This is no valid navigation pattern. The drawer should only be available in the root activity. if there are different views in the root you should use fragments. if you jump to other activites those should not have a drawer.

still you can do this with the drawer. but i highly recommend to do it like it should be done.

Hi Mike,

Although I agree with you that a navigation drawer in any other activity other than the root is kind of not a valid navigation pattern, but Google itself uses this pattern in the Play Store app. Go into the detail activity of an app, then swipe from the left edge to reveal the drawer. There is no indication of a drawer being there, but it's there.

@ammar786-1 i know ;). it was just a hint to follow the guidelines (and we all know google itself doesn't do this :P)

about the main issue. I think the BaseActivity he has written must be wrong, there is no thing in the Drawer which should prevent this.

In fact it should work exactly as in any other default activity. as seen in the sample app.

@mikepenz But the google io schedule app has drawer in all activities although they finish the activity when you navigate to different screen probably to avoid complexities of back pattern. Google should maintain one valid pattern across all it apps.

@ammar786-1 In case you want the drawer in all activities Follow Google io Schedule app on github. It has a BaseActivity from which all activites extend. Also do make changes like extending AppCompatActivity and themes...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

y2kshane picture y2kshane  ·  4Comments

singhalavi picture singhalavi  ·  4Comments

sonh picture sonh  ·  3Comments

ghost picture ghost  ·  3Comments

pranjal-joshi picture pranjal-joshi  ·  3Comments