kanytu / android-material-drawer-template

An Android template with navigation drawer for material design
Apache License 2.0
674 stars 217 forks source link

How to make drawer stay closed when the app first runs? #7

Closed tekniksinc closed 9 years ago

tekniksinc commented 9 years ago

Added the drawer to my activity but every time I run the app to test it, the drawer is open. I have to close it to see the main activity.

How do I open the app with the drawer staying closed?

codybaldwin commented 9 years ago

Android documentation explains that this is the proper functionality so that the user knows how to navigate within the app.

kanytu commented 9 years ago

This is intended behavior. Once you manually close the drawer the app will save a flag indicating that the user knows how to use the drawer and there is no need to open it at start. If you want to remove this check remove line https://github.com/kanytu/android-material-drawer-template/blob/master/app/src/main/java/com/poliveira/apps/materialtests/NavigationDrawerFragment.java#L60 with mUserLearnedDrawer = true;

For more information on this behaviour: https://developer.android.com/design/patterns/navigation-drawer.html#Interaction

At first use, show the navigation drawer automatically to help the user learn the functionality and structure of your app.