Convert Figma logo to code with AI

neokree logoMaterialNavigationDrawer

Navigation Drawer Activity with material design style and simplified methods

1,560
433
1,560
10

Top Related Projects

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.

DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.

Side menu with some categories to choose.

swipe display drawer with flowing & bouncing effects.

Quick Overview

MaterialNavigationDrawer is an Android library that provides an implementation of the Material Design navigation drawer. It offers a customizable and easy-to-use solution for creating navigation drawers in Android applications, following Google's Material Design guidelines.

Pros

  • Easy integration with Android projects
  • Customizable appearance and behavior
  • Supports multiple account selection
  • Follows Material Design guidelines for a consistent user experience

Cons

  • Limited documentation and examples
  • Not actively maintained (last update was in 2016)
  • May not be compatible with the latest Android versions and libraries
  • Some reported issues with stability and performance

Code Examples

  1. Basic drawer setup:
public class MainActivity extends MaterialNavigationDrawer {
    @Override
    public void init(Bundle savedInstanceState) {
        MaterialSection section1 = newSection("Section 1", new Fragment1());
        MaterialSection section2 = newSection("Section 2", new Fragment2());
        addSection(section1);
        addSection(section2);
    }
}
  1. Adding a header with user information:
MaterialAccount account = new MaterialAccount(this, "John Doe", "john@example.com", R.drawable.profile_image, R.drawable.background_image);
addAccount(account);
  1. Creating a section with custom icon:
MaterialSection section = newSection("Settings", new IconDrawable(this, FontAwesomeIcons.fa_cog), new SettingsFragment());
addSection(section);

Getting Started

  1. Add the dependency to your build.gradle file:
dependencies {
    implementation 'it.neokree:MaterialNavigationDrawer:1.3.3'
}
  1. Create an activity that extends MaterialNavigationDrawer:
public class MainActivity extends MaterialNavigationDrawer {
    @Override
    public void init(Bundle savedInstanceState) {
        // Add sections and customize your drawer here
        MaterialSection section1 = newSection("Home", new HomeFragment());
        addSection(section1);
    }
}
  1. Update your AndroidManifest.xml to use the new activity:
<activity
    android:name=".MainActivity"
    android:theme="@style/MaterialNavigationDrawerTheme">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Competitor Comparisons

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.

Pros of MaterialDrawer

  • More actively maintained with frequent updates and bug fixes
  • Extensive customization options and flexibility
  • Better support for modern Android development practices and libraries

Cons of MaterialDrawer

  • Steeper learning curve due to more complex API
  • Larger library size, which may impact app size

Code Comparison

MaterialNavigationDrawer:

new MaterialNavigationDrawer()
    .withActivity(this)
    .withToolbar(toolbar)
    .addSection(newSection("Section 1", new Fragment1()))
    .addSection(newSection("Section 2", new Fragment2()))
    .build();

MaterialDrawer:

DrawerBuilder()
    .withActivity(this)
    .withToolbar(toolbar)
    .addDrawerItems(
        PrimaryDrawerItem().withName("Section 1"),
        PrimaryDrawerItem().withName("Section 2")
    )
    .build()

Key Differences

  • MaterialDrawer offers more granular control over drawer items and their appearance
  • MaterialNavigationDrawer provides a simpler API for basic navigation drawer setups
  • MaterialDrawer has better Kotlin support and integration with modern Android libraries

Recommendation

Choose MaterialDrawer for more complex, customizable navigation drawers in actively maintained projects. Opt for MaterialNavigationDrawer if simplicity and ease of implementation are priorities, but be aware of its less frequent updates.

DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.

Pros of SlidingRootNav

  • More customizable and flexible, allowing for various drawer layouts and animations
  • Supports both left and right-side drawers
  • Actively maintained with recent updates and bug fixes

Cons of SlidingRootNav

  • Slightly more complex implementation compared to MaterialNavigationDrawer
  • May require more setup code for basic functionality

Code Comparison

MaterialNavigationDrawer:

MaterialNavigationDrawer drawer = new MaterialNavigationDrawer(this)
    .addSection(newSection("Section 1", new Fragment1()))
    .addSection(newSection("Section 2", new Fragment2()))
    .build();

SlidingRootNav:

new SlidingRootNavBuilder(this)
    .withMenuLayout(R.layout.menu_left_drawer)
    .withDragDistance(140)
    .withRootViewScale(0.7f)
    .withRootViewElevation(10)
    .withSavedState(savedInstanceState)
    .inject();

SlidingRootNav offers more customization options in its builder, while MaterialNavigationDrawer provides a simpler setup for basic navigation drawers. SlidingRootNav's approach allows for greater flexibility in terms of layout and animation, but may require more initial configuration.

Side menu with some categories to choose.

Pros of Side-Menu.Android

  • Offers a visually appealing and animated side menu with customizable transitions
  • Provides a modern, material design-inspired look out of the box
  • Lightweight and focused specifically on side menu functionality

Cons of Side-Menu.Android

  • Less actively maintained, with fewer recent updates
  • Limited documentation and examples compared to MaterialNavigationDrawer
  • Narrower scope, focusing only on side menu implementation

Code Comparison

Side-Menu.Android:

ResideMenu resideMenu = new ResideMenu(this);
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(this);
resideMenu.addMenuItem(menuItem, ResideMenu.DIRECTION_LEFT);

MaterialNavigationDrawer:

public class MainActivity extends MaterialNavigationDrawer {
    @Override
    public void init(Bundle savedInstanceState) {
        addSection(newSection("Section 1", new Fragment1()));
        addBottomSection(newSection("Settings", R.drawable.ic_settings, new SettingsFragment()));
    }
}

MaterialNavigationDrawer offers a more integrated approach with activity extension, while Side-Menu.Android provides a standalone menu object. The former focuses on a complete navigation drawer solution, while the latter emphasizes customizable side menu animations.

swipe display drawer with flowing & bouncing effects.

Pros of FlowingDrawer

  • Unique flowing animation effect for a more visually appealing drawer
  • Customizable menu icon and animation styles
  • Lightweight and easy to implement

Cons of FlowingDrawer

  • Less comprehensive documentation compared to MaterialNavigationDrawer
  • Fewer customization options for drawer content
  • May not follow Material Design guidelines as closely

Code Comparison

MaterialNavigationDrawer:

MaterialNavigationDrawer drawer = new MaterialNavigationDrawer(this);
drawer.addSection(newSection("Section 1", new Fragment()));
drawer.addSection(newSection("Section 2", new Fragment()));
setContentView(drawer);

FlowingDrawer:

mDrawer = (FlowingDrawer) findViewById(R.id.drawerlayout);
mDrawer.setTouchMode(ElasticDrawer.TOUCH_MODE_BEZEL);
mDrawer.setOnDrawerStateChangeListener(new ElasticDrawer.OnDrawerStateChangeListener() {
    // Implement listener methods
});

Both libraries offer easy-to-use drawer implementations, but FlowingDrawer focuses more on the animation aspect, while MaterialNavigationDrawer provides a more comprehensive solution for navigation drawer content and structure. FlowingDrawer may be preferred for projects prioritizing unique visual effects, while MaterialNavigationDrawer might be better suited for applications requiring a more traditional Material Design approach with extensive customization options.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

MaterialNavigationDrawer

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

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

IMPORTANT NOTICE

I'm working on the version 2 of this library, but I want to restart from scratch. If you need a stable version you can use the first version of this library, available here

Useful issues

For open a useful issue, please follow this little guide:

  1. Check if your issue is not opened yet. This prevent to have different questions to the same problem.
  2. When you open an issue, please add the library version used, devices tested and related api.