-
Notifications
You must be signed in to change notification settings - Fork 433
Functionalities
When the Activity starts, the drawer will be open automatically for let the users to know that there is a navigation drawer. It seems like pretty obvious to us, but there are some users that must be taught to do that (unfortunatelly).
Statically, add this line in your navigation drawer theme:
<!-- alpha, ufficially released from 1.3.3 -->
<item name="learningPattern">false</item>
Programmatically, add this code to your init()
method:
this.disableLearningPattern();
There are a lot of methods for use the back button. Actually this library supports these patterns:
- Back Anywhere (default)
(if user click on back button, the activity will close) - Back to first
(if user click on back button, the content change to the first section fragment) - Custom backpattern
(see below)
for setting the pattern add in your init this code:
setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_TO_FIRST);
When you use this backpattern you should override this method in your MaterialNavigationDrawer
Activity:
@Override
protected MaterialSection backToSection(MaterialSection currentSection) {
// example of use:
if(currentSection == night) {
return last;
}
if(currentSection == last) {
return section1;
}
return super.backToSection(currentSection);
}
if you have some pattern to suggest please comment on this issue, thanks.
multi pane support makes the drawer always open on the left, but only with tablet in landscape mode.
Statically, add this line in your navigation drawer theme:
<item name="multipaneSupport">true</item>
Programmatically, add this method to your init()
addMultiPaneSupport();
You can override the first section that is loaded when the navigation drawer starts.
Statically, add this line in your navigation drawer theme:
<item name="defaultSectionLoaded">0</item>
<!-- 0 is default for the first, 1 for second etc. -->
Programmatically, add this method to your init()
setDefaultSectionLoaded(0);
NOTE the section number starts from 0.
Statically, add this line in your navigation drawer theme:
<item name="toolbarElevation">true</item>
Programmatically, add this method to your init()
enableToolbarElevation();