Skip to content
This repository was archived by the owner on Apr 30, 2020. It is now read-only.
neokree edited this page Dec 7, 2014 · 19 revisions

MaterialNavigationDrawer wiki

this is a simple wiki that show you all library functionality

Sections

A section is a simple element of your navigation drawer list. There are two type of section at this time:

  • Text Section
  • Text and Icon Section

Every section could have a notifications number.

There are two different lists where you can add your section:

  • Top list (default list)
  • Bottom List
    It is a list used exclusively for About, Settings or other things like this.
Create Section methods
    // only text section, it opens an activity
    public MaterialSection newSection(String title,Intent target)
    
    // only text section, it opens a fragment
    public MaterialSection newSection(String title,Fragment target)
    
    // icon bitmap and text section, it opens an activity
    public MaterialSection newSection(String title, Bitmap icon,Intent target)
    
    // icon bitmap and text section, it opens a fragment
    public MaterialSection newSection(String title, Bitmap icon,Fragment target)
    
    // icon drawable and text section, it opens an activity
    public MaterialSection newSection(String title, Drawable icon, Intent target)
    
    // icon drawable and text section, it opens a fragment
    public MaterialSection newSection(String title, Drawable icon, Fragment target)
Create Bottom Section methods
    // only text section, it opens an activity
    public MaterialSection newBottomSection(String title,Intent target)
    
    // only text section, it opens a fragment
    public MaterialSection newBottomSection(String title,Fragment target)
    
    // icon bitmap and text section, it opens an activity
    public MaterialSection newBottomSection(String title, Bitmap icon,Intent target)
    
    // icon bitmap and text section, it opens a fragment
    public MaterialSection newBottomSection(String title, Bitmap icon,Fragment target)
    
    // icon drawable and text section, it opens an activity
    public MaterialSection newBottomSection(String title, Drawable icon, Intent target)
    
    // icon drawable and text section, it opens a fragment
    public MaterialSection newBottomSection(String title, Drawable icon, Fragment target)
Change Section Color
int color = Color.parseColor("FFFFFF");
mySection.setSectionColor(color);
Set/get number notifications
int number = 4;
mySection.setNotifications(number);

int notifications = mySection.getNotifications();

Separators

A separator (or divisor) is a simple grey line used for diversify group of sections.

Add separator method
@Override
    public void init(Bundle savedInstanceState) {
        this.addDivisor();
    }

FAQ

How can I get my action bar / toolbar?

From your Activity:

// get toolbar
this.getToolbar();
// get Action Bar
this.getSupportActionBar();

From your Fragment:

// get toolbar
((MaterialNavigationDrawer)this.getActivity()).getToolbar();
// get action bar
this.getActivity().getSupportActionBar();
How can I get the current Section?

From your Activity:

this.getCurrentSection();

From your Fragment:

((MaterialNavigationDrawer)this.getActivity()).getCurrentSection();
Clone this wiki locally