A flexible, easy to use, unique drawer library for your Android project.

Overview

Duo Navigation Drawer Download Build Status Android Arsenal

This Android library provides an easy way to create an alternative navigation drawer for android. Instead of a drawer that slides over the main content of the Activity, this lets the content slide away and reveal a menu below it.

By default it applies a scaling effect on the content and menu.

AndroidX

If you're still using legacy Android Support libraries you can use v2.0.8. AndroidX is supported by default since v3.0.0.

Demo

Demo CountPages alpha

The demo app is included in the app module in this project.

Getting Started

Prerequisites

You can download a jar from GitHub's releases page.

Or use Gradle:

repositories {
    mavenCentral() // jcenter() works as well because it pulls from Maven Central
}

dependencies {
    compile 'nl.psdcompany:duo-navigation-drawer:3.0.0'
}

Or Maven:

<dependency>
  <groupId>nl.psdcompany</groupId>
  <artifactId>duo-navigation-drawer</artifactId>
  <version>3.0.0</version>
  <type>pom</type>
</dependency>

Installing

1. Add the DuoNavigationDrawer view to your activity

<nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    ... />

2. Add the content view view to your drawer

Add the a content view to your drawer by adding the attribute: app:content to your drawer.

<nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    app:content="@layout/content"
    ... />

or, you can also add a view within the drawer with the tag content.

<nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    ... >
    
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:tag="content"
        ... />

</nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout>

3. Add the menu view view to your drawer

Add the a menu view to your drawer by adding the attribute: app:menu to your drawer.

<nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    app:menu="@layout/menu"
    ... />

or, you can also add a view within the drawer with the tag menu.

<nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    ... >
    
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:tag="menu"
        ... />

</nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout>

4. Initialize the drawer view

The API of the DuoNavigationDrawer is mostly the same as the original DrawerLayout from the Android design library. Same for DuoDrawerToggle which is a modified version of the ActionBarDrawerToggle to support the DuoDrawerLayout.

DuoDrawerLayout drawerLayout = (DuoDrawerLayout) findViewById(R.id.drawer);
DuoDrawerToggle drawerToggle = new DuoDrawerToggle(this, drawerLayout, toolbar,
        R.string.navigation_drawer_open,
        R.string.navigation_drawer_close);

drawerLayout.setDrawerListener(drawerToggle);
drawerToggle.syncState();

Customization

Using the DuoMenuView

If you want your menu to look like the demo. you should consider using the DuoMenuView For more info using the DuoMenuView click here.

Effects

All values are Float values. The default values are used in the example.

Content scaling effect

The scaling applied on the content when sliding it from left to right.

app:contentScaleClosed="1.0"
app:contentScaleOpen="0.7"

Menu scaling effect

The scaling applied on the menu when sliding the content from left to right.

app:menuScaleClosed="1.1"
app:menuScaleOpen="1.0"

Click to close surface scaling effect

The scaling applied on the click to close surface when the drawer is open.

app:clickToCloseScale="0.7"

Menu alpha effect

The alpha on the menu when sliding the content from left to right.

app:menuAlphaClosed="0.0"
app:menuAlphaOpen="1.0"

Content margin factor

This value is used to calculate how much of the content should be visible when the content is slided to the right. This is calculated with the width of the DuoDrawerLayout when: getWidth * marginFactor. So setting this to 1.0f will slide the content out of the activity. The default is 0.7f.

app:marginFactor="0.7"

Apps using the DuoNavigationDrawer

Feel free to apply your app to the list by sending me an email with a link to your app in the play store.

Developed By

Donations

If you'd like to support DuoNavigationDrawer development, you could make some donations here:

  • Donate

Thank you very much in advance!

License

Copyright 2017 Alexander Pot

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • keystore Properties the system cannot find the file specified

    keystore Properties the system cannot find the file specified

    i am getting error says how do i fix this?? Error:(6, 0) D:\Android\duo-navigation-drawer-master\keystore.properties (The system cannot find the file specified) Open File

    opened by dondeepak 6
  • Navigation drawer not working properly in tablets.

    Navigation drawer not working properly in tablets.

    I have tested it in a real device Nokia N1 and also in an emulator Nexus 9. It seems that when the drawer is open its hard to close it, and also the menus are not clickable. Please fix this issue as I really like this drawer it works perfectly in phones I have tested it in Nexus 6p (real device) and also Nexus 5 (real device) and a bunch of emulators. Thanks.

    opened by perasoft 3
  • How to

    How to "replace" fragment not to "add" in goToFragment()

    all my fragment superposed in one page when i change transaction.add(R.id.container, fragment).commit(); to transaction.replace(R.id.container, fragment).commit();

    application crash with error :

    No view found for id 0x7f090054 (com.packa...:id/content) for fragment SFrag{48bbddc #8 id=0x7f090054}

    help please

    opened by gaiththewolf 2
  • Custom Header and Footer Layout Don't Work

    Custom Header and Footer Layout Don't Work

    Hi, I try to change the text John Doe and its subtitle Manager by using new layout and set it in the menu.xml but seems doesn't work...

    I follow the instruction here https://github.com/psdcompany/duo-navigation-drawer/issues/14 but the header and footer still show the same text.

    How to make it works?


    Edit: Sorry it works, I edited the menu.xml but actually the menu is written directly in main activity xml, thanks

    opened by saleho27 1
  • Background Color of Navigation Drawer

    Background Color of Navigation Drawer

    Hey its a question not an issue, i have just noticed that navigation drawer background color is being picked up from of toolbar of extending activity, so if there's a way we can customize the background color of navigation drawer

    opened by mhafeezgr8 1
  • Keep toolbar always on top ?

    Keep toolbar always on top ?

    Hello, First of all, thank you for sharing your work. Also, here is a question, not an issue report.

    Is there a possibility to keep the toolbar always visible on top, so that on the hamburger click, the menu drawer slides below the toolbar?

    opened by Kintaro37 1
  • not able to catch hamburger icon click event

    not able to catch hamburger icon click event

    its work fine before i implement duo-navigation-drawer, now i m not able to get home button click event, its like drawer has total control of toolbar. we cant do anything without getting context of drawer, if i remove drawer toolbar works fine.. i m able change icon and everything. with drawer i m getting default hamburger icon, event if i set manually its not changing.

    opened by ZeroCool00 1
  • Not able to apply background image to DuoMenuView

    Not able to apply background image to DuoMenuView

    is there any way to apply background image to menu... i set programmatically and in xml file too. but my image not rendering... only primary color is applied.

    question 
    opened by ZeroCool00 1
  • ProGaurd Issue

    ProGaurd Issue

    Please provide progaurd file App force closing as resources are missing res/drawable/duo_shape_rectangled_rounded_color_accent.xml Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class nl.psdcompany.duonavigationdrawer.views.DuoMenuView at android.view.LayoutInflater.createView(LayoutInflater.java:620) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at android.support.v7.app.k.b(Unknown Source) at android.support.v7.app.c.setContentView(Unknown Source) at com.ingridtech.fabric.ui.activity.HomeActivity.onCreate(Unknown Source) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5001)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createView(LayoutInflater.java:594) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  at android.support.v7.app.k.b(Unknown Source)  at android.support.v7.app.c.setContentView(Unknown Source)  at com.ingridtech.fabric.ui.activity.HomeActivity.onCreate(Unknown Source)  at android.app.Activity.performCreate(Activity.java:5231)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5001)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class Button at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at nl.psdcompany.duonavigationdrawer.views.DuoMenuView.d(Unknown Source) at nl.psdcompany.duonavigationdrawer.views.DuoMenuView.a(Unknown Source) at nl.psdcompany.duonavigationdrawer.views.DuoMenuView.<init>(Unknown Source) at nl.psdcompany.duonavigationdrawer.views.DuoMenuView.<init>(Unknown Source) at java.lang.reflect.Constructor.constructNative(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at android.view.LayoutInflater.createView(LayoutInflater.java:594)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  at android.support.v7.app.k.b(Unknown Source)  at android.support.v7.app.c.setContentView(Unknown Source)  at com.ingridtech.fabric.ui.activity.HomeActivity.onCreate(Unknown Source)  at android.app.Activity.performCreate(Activity.java:5231)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5001)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  Caused by: android.content.res.Resources$NotFoundException: File res/drawable/duo_shape_rectangled_rounded_color_accent.xml from drawable resource ID #0x7f020063 at android.content.res.Resources.loadDrawable(Resources.java:2096) at android.content.res.TypedArray.getDrawable(TypedArray.java:602) at android.view.View.<init>(View.java:3554) at android.widget.TextView.<init>(TextView.java:623) at android.widget.Button.<init>(Button.java:107) at android.support.v7.widget.i.<init>(Unknown Source) at android.support.v7.widget.i.<init>(Unknown Source) at android.support.v7.app.m.a(Unknown Source) at android.support.v7.app.k.c(Unknown Source) at android.support.v7.app.k.a(Unknown Source) at android.support.v4.i.l$a.onCreateView(Unknown Source) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at nl.psdcompany.duonavigationdrawer.views.DuoMenuView.d(Unknown Source)  at nl.psdcompany.duonavigationdrawer.views.DuoMenuView.a(Unknown Source)  at nl.psdcompany.duonavigationdrawer.views.DuoMenuView.<init>(Unknown Source)  at nl.psdcompany.duonavigationdrawer.views.DuoMenuView.<init>(Unknown Source)  at java.lang.reflect.Constructor.constructNative(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at android.view.LayoutInflater.createView(LayoutInflater.java:594)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  at android.support.v7.app.k.b(Unknown Source)  at android.support.v7.app.c.setContentView(Unknown Source)  at com.ingridtech.fabric.ui.activity.HomeActivity.onCreate(Unknown Source)  at android.app.Activity.performCreate(Activity.java:5231)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5001)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2 at android.content.res.TypedArray.getColor(TypedArray.java:327) at android.graphics.drawable.GradientDrawable.inf

    opened by sajorahasan 1
  • AndroidX Migration

    AndroidX Migration

    This pull request migrates the library to AndroidX. I also bumped the major version to 3.0.0 since this won't be backwards compatible with the old Android support libraries.

    opened by bvdaakster 0
  • Menu icon

    Menu icon

    hey, there great stuff. totally love it. But there is one thing i want to change that bullet point on side menu can it possible to change it by my icon. send some help pls

    opened by SUMIT0733 0
  • Not Work with AutoScrollViewPager

    Not Work with AutoScrollViewPager

    DuoDrawerLayout not work with AutoScrollViewPager it was automatically open default how can close menudrawer???

    drawerLayout.closeDrawer()

    drawerLayout.openDrawer()

    this methods not working

    opened by JayeshDankhara 0
  • Your navigation drawer no longer works

    Your navigation drawer no longer works

    Class referenced in the layout file, nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout, was not found in the project or the libraries

    Your app doesn't work

    opened by ghost 0
  • Menu item height

    Menu item height

    How can I change the height of one menu item? I tried with android:height and android:padding in new Style and it does not work.

    I want to have smaller padding between text in menu item and the view holder.

    opened by tomchemitrov 0
  • How to add gravity to drawer?

    How to add gravity to drawer?

    Hi, Thanks for such a nice library.

    I had an issue. I've added 4 items to a drawer. Those items are showing in the center of the drawer. I want it to show right below the header in a vertical sequence. I've tried adding android:layout_gravity="top" android:gravity="top" to xml DuoDrawerLayout but no use. Please let me know how to resolve it.

    opened by Dnyaneshwar1926 0
Releases(v3.0.0)
An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!

SlidingMenu (Play Store Demo) SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus li

Jeremy Feinstein 11.2k Sep 30, 2022
Jetpack Compose BottomDrawerScaffold (Material Bottom Drawer)

BottomDrawerScaffold Current Compose Version: 1.0.2 Compose BottomDrawerScaffold which implements the Material Bottom Drawer https://material.io/compo

Alexander Karkossa 9 Sep 27, 2022
New style for app design simple bottom navigation with side navigation drawer UI made in Jetpack Compose.😉😎

BottomNavWithSideDrawer New style for app design simple bottom navigtaion with side navigation drawer UI made in Jetpack Compose. ?? ?? (Navigation Co

Arvind Meshram 4 Jul 6, 2022
Navigation Drawer Bottom Navigation View

LIVE #019 - Toolbar, Navigation Drawer e BottomNavigationView com Navigation Com

Kaique Ocanha 6 Jun 15, 2022
CustomNavigationDrawer - Custom Navigation Drawer with compose

An easy sample to explore navigation component and navigation drawer from Jetpac

rafael altamirano 0 Jan 4, 2022
A sleek, out of the box, easy to understand and use, swipe gesture based Navigational Library for android.

Facilis Swipe gesture based navigational library for Android. Watch Demo Video: Getting Started To get this project into your build: Gradle Add it in

Prem Suman 35 Feb 15, 2022
A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.

AnimatedBottomBar A customizable and easy to use bottom bar view with sleek animations. Examples Playground app Download the playground app from Googl

Joery 1.1k Sep 27, 2022
A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.

A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.

Joery Droppers 1000 Dec 5, 2021
Animated Tab Bar is an awesome navigation extension that you can use to add cool, animated and fully customizable tab navigation in your apps

Animated Tab Bar is an awesome navigation extension that you can use to add cool, animated and fully customizable tab navigation in your apps. The extension provides handy methods and properties to change the behaviour as well as the appearance of the navigation bar.

Zain Ul Hassan 3 Jul 27, 2022
A small navigation library for Android to ease the use of fragment transactions & handling backstack (also available for Jetpack Compose).

A small navigation library for Android to ease the use of fragment transactions & handling backstack (also available for Jetpack Compose).

Kaustubh Patange 84 Sep 11, 2022
A library that you can use for bottom navigation bar. Written with Jetpack Compose

FancyBottomNavigationBar A library that you can use for bottom navigation bar. W

Alperen Çevlik 3 Jul 27, 2022
Android Library for making animated tutorials inside your app

##SlidingTutorial Cleveroad introduces Sliding Tutorial Library for Android Hey guys, hope you haven’t started developing a tutorial for your Android

Cleveroad 2.5k Sep 17, 2022
Alligator is a modern Android navigation library that will help to organize your navigation code in clean and testable way.

Alligator Alligator is a modern Android navigation library that will help to organize your navigation code in clean and testable way. Features Any app

Artur Artikov 292 Jul 7, 2022
DSC Moi University session on using Navigation components to simplify creating navigation flow in our apps to use best practices recommended by the Google Android Team

Navigation Components Navigate between destination using safe args How to use the navigation graph and editor How send data between destinations Demo

Breens Mbaka 6 Feb 3, 2022
Android Navigation Fragment Share Element Example: Use Share Element Transition with recyclerView Item and ViewPager2 Item.

Android-Navigation-Fragment-Share-Element-Example 说明 Android 使用Navigation导航切换Fragment中使用共享元素过渡动画的例子:将在listFragment的RecyclerView的Item共享元素过渡到pagerFragme

null 2 Sep 16, 2022
Use Fragment like Activity

Fragivity : Use Fragment like Activity English | 中文文档 Fragivity is a library used to build APP with "Single Activity + Multi-Fragments" Architecture R

fundroid 273 Sep 15, 2022
NavigationAndFragments - A use case for fragments and navigation

NavigationAndFragments A use case for fragments and navigation. To implement this use case, follow these steps : Create a new fragment navigation xml

Google Developers 3 Sep 15, 2022
Dismiss your keyboard by tapping anywhere outside it.

Keyboard Dismisser What is this? Keyboard Dismisser is a simple library that allows you to dismiss keyboard by tapping anywhere outside it. Currently

Gabriel Samojło 49 Nov 28, 2021
Navigation Component: THE BEST WAY to create navigation flows for your app

LIVE #017 - Navigation Component: A MELHOR FORMA de criar fluxos de navegação para o seu app! Código fonte do projeto criado na live #017, ensinando c

Kaique Ocanha 4 Jun 15, 2022