Git Product home page Git Product logo

materialnavigationdrawer's Introduction

MaterialNavigationDrawer

Navigation Drawer Activity with material design style and simplified methods
Android Arsenal     Donate

It requires 11+ API and android support v7 (Toolbar)

Download example apk

How to use

In your Activity... ```java public class MyActivity extends MaterialNavigationDrawer {
@Override
public void init(Bundle savedInstanceState) {
    // set cover background
    this.setDrawerBackground(this.getResources().getDrawable(R.drawable.mat1));
    // set user photo and data
    this.setUserPhoto(this.getResources().getDrawable(R.drawable.photo));
    this.setUsername("NeoKree");
    this.setUserEmail("[email protected]");

    // add your sections
    this.addSection(this.newSection("Section 1",new FragmentIndex()));
    this.addSection(this.newSection("Section 2",new FragmentIndex()));
    this.addDivisor();
    this.addSection(this.newSection("Section 2",this.getResources().getDrawable(R.drawable.section2),new FragmentIndex()));
    this.addBottomSection(this.newBottomSection("Settings",this.getResources().getDrawable(R.drawable.settings),new FragmentSettings()));
}

}

In your styles.xml
```xml
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/light_blue_500</item>
        <item name="colorPrimaryDark">@color/light_blue_800</item>
        <item name="colorAccent">@color/grey_1000</item>
        <item name="windowActionBar">false</item>
    </style>

</resources>

N.B. Not override OnCreate method! Use init method instead.

Add Section methods
```java // 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)

<h6>Add Bottom Section methods</h6>
```java
    // 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)
Add separator method
```java @Override public void init(Bundle savedInstanceState) { this.addDivisor(); } ```

How to import

Android Studio
Add this to your build.gradle: ```java repositories { mavenCentral() }

dependencies { compile 'it.neokree:MaterialNavigationDrawer:1.0.1' }


<img src="https://raw.github.com/neokree/MaterialNavigationDrawer/master/screen1.png" alt="screenshot" width="300px" height="auto" />
<img src="https://raw.github.com/neokree/MaterialNavigationDrawer/master/screen2.png" alt="screenshot" width="300px" height="auto" />
<img src="https://raw.github.com/neokree/MaterialNavigationDrawer/master/screen3.png" alt="screenshot" width="300px" height="auto" />
<img src="https://raw.github.com/neokree/MaterialNavigationDrawer/master/screen4.png" alt="screenshot" width="300px" height="auto" />

materialnavigationdrawer's People

Contributors

neokree avatar

Watchers

Darshan Mistry avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.