A Gmail-like Material Drawer implementation

Overview

AdvancedMaterialDrawer

Android Arsenal API

Donate

A Gmail-like Material Drawer implementation

Based on neokree's MaterialDrawer library, but they are not the same. I have made many improvments, changes and added a lot of new features. Big thanks to neokree, without him this library would not exist.

Main Features:

Different Drawer types

  • HeadItem (f.e. screenshot 1)
  • No header (f.e. screenshot 6)
  • Only Image in header (see example tool)
  • Create your own header style (screenshot 7)

Head Item (Account):

  • Unlimited Head-Items (Accounts), tested with 100 Head-Items
  • Head-Item listeners for Avatar or Background taps
  • Adding and removing Head-Items at runtime
  • Every Head-Item can have its own menu
  • Create your own Head-Item style (Custom Head-Item)
  • Or no Head-Item, if you need only the menu

Menu:

  • Menu with unlimit Menu-Items
  • Adding and removing Menu-Items at runtime
  • Only icon menu (screenshot 8)
  • Available Menu-items:
    • Labels
    • Divider
    • Normal Sections
      • can call new fragment, activity or implements own onClick
      • with and without icon
      • with notification number
    • Only Icon
      • can call new fragment, activity or implements own onClick
    • Bottom-Sections
      • same as normal section
    • Custom Sections ! (add your own section implementation, like a checkbox etc.) see screenshot 5

Fully themeable (screenshot 11)

Other:

  • Drawer can be over and below the toolbar
  • Tablet support
  • Toolbar overflow support, so a image can be your background. (screenshot 9)
  • Many many more: Setting your own Fragment on Start, etc. Play with the example app ;).
  • The screenshots doesn't show all functions, you can do many more with the lib.

Write your own header Class

Many Many more

Live Demo (Lib-Version 2.0.0 (17.07.15))

You can test the example application in your web browser. https://appetize.io/app/dqmyynvjanx9hydtq4a4vjbkzw

Example APK (Lib-Version 2.0.0 (17.07.15))

https://github.com/madcyph3r/AdvancedMaterialDrawer/raw/master/example-release.apk

or on the play store (Lib-Version 2.0.0 (17.07.15))

Android app on Google Play

Download

repositories {
    maven { url 'http://dl.bintray.com/madcyph3r/maven/' }
}

dependencies {
    compile 'de.madcyph3r:materialDrawer:2.0.0@aar'
}

Dependencies

compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nineoldandroids:library:2.4.0'

Usage

There are a lot of examples with explanations, how to use the library, here is a small example with one Head-Item. You will get the result from screenshot 1. You see, it's easy :)

public class HeadItemOneActivity extends MaterialNavHeadItemActivity {

    MaterialNavigationDrawer drawer = null;

    @Override
    protected boolean finishActivityOnNewIntent() {
        return false;
    }

    @Override
    protected int getNewIntentRequestCode(Class clazz) {
        return 0;
    }

    @Override
    public void init(Bundle savedInstanceState) {

        drawer = this;

        // information text for the fragment
        Bundle bundle = new Bundle();
        bundle.putString("instruction", "This example shows the head item style.");

        Fragment fragmentInstruction = new FragmentInstruction();
        fragmentInstruction.setArguments(bundle);

        // create menu
        MaterialMenu menu = new MaterialMenu();
        menu.add(new MaterialItemSectionFragment(this, "Instruction", fragmentInstruction, "Head Item Style (One Item)"));
        menu.add(new MaterialItemSectionFragment(this, "Section 1", new FragmentDummy(), "Section 1"));
        menu.add(new MaterialItemSectionFragment(this, "Section 2", new FragmentDummy(), "Section 2"));
        menu.add(new MaterialItemSectionFragment(this, "Section 3", new FragmentDummy(), "Section 3"));

        // create Head Item
        // use bitmap and make a circle photo
        final Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.yourAvatar);
        final RoundedCornersDrawable drawableAppIcon = new RoundedCornersDrawable(getResources(), bitmap);
        MaterialHeadItem headItem = new MaterialHeadItem(this, "My HeadItem", "My Subtitle", drawableAppIcon, R.drawable.yourBackground, menu);
        this.addHeadItem(headItem);

        // load menu
        this.loadMenu(getCurrentHeadItem().getMenu());

        // load the first MaterialItemSectionFragment from the menu
        this.loadStartFragmentFromMenu(getCurrentHeadItem().getMenu());
    }

    @Override
    public void afterInit(Bundle savedInstanceState) {

    }
}

From <= 1.1.4 to 2.0.0

I have changed a lot of names and methods. Sorry for that. But now its a lot easier to use this library. The methods name and parameters make more sense. Better abstraction level for the menu items and drawer types. A really better code understanding. Please look in the examples, for the code changes. Then edit your code to the new code base.

Others

  • If you've found an issue, look up the open issues and submit a new one if it isn't yet reported.
  • If you like the library press the star ;)
  • A Wiki with some Introduction will come soon.

Screenshots

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

screenshot

Comments
  • Master Child Navigation and AdvancedMaterialDrawer with SlidingTab

    Master Child Navigation and AdvancedMaterialDrawer with SlidingTab

    Hi, Sorry for bugging you again. But I want to clear few more things like:

    1. Can we show drawer toggle animation when going back to master fragment from child?
    2. As I said in issue #24 that section with activity opens again & again, but section with fragment already loaded doesn't closes the drawer. I mean that section1 loads B fragment then clicking section1 again should close the drawer (without loading fragment again, you may already have taken care of this reloading, I think). Please check if you can close the drawer if fragment is already loaded.

    Thanks for your example with MasterChildNavigation, though you forgot to add that in your app I think. To test I have added this in your FunctionallyFragment.java and added this activity to manifest.

    content.add(new ExampleData("Master/Child Fragment Activity", MasterChildNavActivity.class));
    

    Thanks again.

    opened by thevirus20 18
  • divider seems not working

    divider seems not working

    i used the code like so:

    
            newDevisor(menu);
            newSection("Fashion", listpage.newInstance(fashion()), false, menu);
            newDevisor(menu);
    

    it doesnt work as expected.

    opened by jjhesk 10
  • Account photo is changed to color

    Account photo is changed to color

    Hi, i have an issues with photos of account items, if i have more than three accounts (head items) and them go to list, library change photo to pink color like below:

    screenshot_2015-07-09-13-19-14 screenshot_2015-07-09-13-19-25

    opened by b3stia 9
  • How to use with multiple activities

    How to use with multiple activities

    Hi, First of all thanks for this useful library with ripple support on lower android version.

    I am trying to include this library as 2 level navigation with using BaseActivity.

    What I have done is:

    1. Created a BaseActivity to include all code that you have given in your sample code.
    2. MainActivity extends this base activity and I get the drawer as expected with first section fragment loaded(Wiki on neokree repo suggest that first section should should always be fragment, is there a alternative?)

    What I have to do is:

    1. I have another section which is intent and starts a new SecondActivity. Is this possible to make this section as selected when SecondActivity is launched(Currently no section is selected when SecondActivity is launched).
    2. I also get a null pointer exception on DrawerToggle while setting a back arrow instead of hamburger in SecondActivity. I followed same step as you mentioned in issue #16, but didn't help.

    How can I achieve this type of navigation drawer across all activity (like Gmail does, loading a particular email has Inbox section highlighted, maybe they are using fragment) . Is this possible with Activity or I have to use fragment everywhere to achieve this?

    Please help. By the way please add DummyActivity in your example's manifest.xml, as it causes exception. Thanks.

    opened by thevirus20 9
  • actionbar issue background customization

    actionbar issue background customization

    There is an action bar on V21 and V19 styling issue followed by the material drawer. There is a request that I want to make my own pattern or images for the background of the action bar but it doesnt seem to let me doing so. I would like to ask if there is a possible way to achieve this. I would really want to get this under control by a custom attribution declaration in the nagivationdrawer theme.

    opened by jjhesk 8
  • Not Use this lib

    Not Use this lib

    hi, thanks you for develop for this lib i want use this lib but i'm not. run of the project show me this errors :

    03-31 12:42:54.427 2130-2130/com.example.tellfa.myapplication4 E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.tellfa.myapplication4, PID: 2130 java.lang.NoSuchFieldError: de.madcyph3r.materialnavigationdrawer.R$id.current_head_item_title at de.madcyph3r.materialnavigationdrawer.MaterialNavigationDrawer.initViews(MaterialNavigationDrawer.java:300) at de.madcyph3r.materialnavigationdrawer.MaterialNavigationDrawer.onCreate(MaterialNavigationDrawer.java:184) 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)

    please help me, this lib is important for me

    opened by tellfa 8
  • Head item don't show the title and subtitle

    Head item don't show the title and subtitle

    Hi madcyph3r! I'm using your repositorie for an app but I have a problem with the head item: I have copied your head item example but in my app it doesn't show the "Head title" and "Head Subtitle", only the "Head Image"... and I don't know what can I do for fix this... Have you any idea about fix this problem?

    opened by Polomsi 7
  • Toolbar cut off

    Toolbar cut off

    As per title, please refer to my screenshot below. I'm not really sure what is causing this.

    It happens after I put <item name="android:fitsSystemWindows">true</item> into my styles.xml to move Toolbar below status bar.

    styles.xml

    <style name="AppTheme.Base" parent="MaterialNavigationDrawerTheme.Light">
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:fitsSystemWindows">true</item>
    
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorAccent">@color/accent</item>
    </style>
    

    Screenshot 1: With primary color set

    weird

    Screenshot 2: Without any color set. Notice there is some additional status bar being added here. Not sure how it got there. Any solution to this?

    enter image description here

    opened by aemxn 6
  • tablet multipane and configChanges orientation

    tablet multipane and configChanges orientation

    Hi. I'm trying to edit the lib to handle the rotation for tablet without reload all activity and fragment. But i can't do it. The problem is:

    Start app in landscape Menu is opened fixed to left and content to right Change fragment in content fragment Rotate tablet and all is reload, so menu is with slide but first fragment is show and not second

    if i put "configChanges orientation" in manifest, the content fragment show the latest fragment that i loaded, but menu still with slide both for landscape and portrait.

    can you help me please?

    opened by croccio 6
  • Set Each Section Background Color Individually

    Set Each Section Background Color Individually

    I'm trying to set each sections colour individually by getting the view and setting the background but it doesn't seem to be working. Any ideas how i could do this?

    opened by mikescamell 4
  • Latest Android updates causing problems?

    Latest Android updates causing problems?

    I'm not entirely sure of the cause, but I'm quietly confident recent changes in Android have caused a conflict with your library:

    ~PathToMyProject\app\build\intermediates\exploded-aar\de.madcyph3r\materialDrawer\1.1.3\res\values\values.xml
    Error:(2) Attribute "rippleColor" has already been defined
    

    I'm pretty sure it's adding this new dependency which is causing the problem since it seems to compile without it:

    compile 'com.android.support:design:22.2.0'
    
    opened by Morgazmo 3
  • Customize Item Background Colour

    Customize Item Background Colour

    Can i set 2 different background colour for item into a single drawer ? i found outMaterialItemSection's "colorSelected", "colorUnpressed", and "colorOnPressHighlight" had set to private, it should be done by setting it to public right ?

    opened by ghost 1
  • How to use NaviagtionDrawer

    How to use NaviagtionDrawer

    This is hardcore to make all items with menu.add items ... why not use switch so i can manipualte with my items please a good documetation of this app ...

    opened by vullnetlimani 0
  • ActionBar Style (Colors and background)

    ActionBar Style (Colors and background)

    It is possible to change the colors of the ActionBar regardless of the colors use the style of the drawer? I am trying to change the background color and the text color of the actionbar using <item name="drawerActionBarStyle">@style/myToolBarStyle_Base</item>, but it is impossible. Is there any way?

    opened by ander7agar 0
  • ActionBarActivity is deprecated

    ActionBarActivity is deprecated

    Since version 22.1.0 of the support library, the class ActionBarActivity is deprecated. You should use AppCompatActivity (it should work out of the box without you having to do anything else than changing the inheritance of the MaterialNavigationDrawer class)

    opened by mradzinski 3
  • Keep fragment on orientation change

    Keep fragment on orientation change

    Hi, is there any possibility to keep fragment selected on screen when orientation change?

    And i can't use "android:configChanges="orientation|keyboardHidden|screenSize""

    opened by b3stia 2
Releases(2.0.0)
  • 2.0.0(Jul 17, 2015)

    Rewritten some parts of the framework. New and better methods name. New classes for better abstraction level. Now its easier to use and to understand, what you do. Add small functions.

    Source code(tar.gz)
    Source code(zip)
  • 1.1.4(Jul 13, 2015)

    • Fix a critical bug. Sometimes a section click doesn't get recognized.
    • Added support for custom sections. See the all menu example :).
    • Many more fixes and improvments. To long for this here. See github commits for more.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.3(May 27, 2015)

  • 1.1.1(Mar 18, 2015)

    • Split HeadItemOnClick Listener to HeadItemAvatarListener and HeadItem BackgroundListener
    • Fix Bug: loadFragmentOnChanged = false does work now right.
    • Renamed some listener
    • New back pattern
    • Added option for custom fragment title
    • Statusbar is now semitransparent in lollipop
    • Actionbar overlay mode support
    • New example app. New style and a lot of new examples.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Mar 11, 2015)

    Changelog:

    • changed the afterInit() Method, has now Bundle savedInstanceState param.
    • added getActionBarToggle() method, to get the toggle.
    • drawerTouchLocked blocks now a section click too.
    • added method, to show different menu icon (menu, back and none)
    • added example that shows how to change the menu icon and work with them. (ActionBarButtons.java)
    • menu has now the startIndex. so custom/none header can has a start section
    • the HeadItem method with the startIndex is now deprecated, but works correct
    • added option, to show the drawer below the toolbar, see new screenshot
    • added example, how to set the drawer below the toolbar
    • other small changes
    • updated examples
    Source code(tar.gz)
    Source code(zip)
  • 1.0.9(Mar 10, 2015)

    Exclude nineoldandroid library, you mst add it now manually. See readme. Added afterInit() method. See OwnActionBarFont.java for an example.

    Source code(tar.gz)
    Source code(zip)
  • 1.0.8.1(Mar 9, 2015)

    • added ripple support
    • comment out useless code
    • example app has now min sdk 10 in the gradle build
    • renamed some methods in the menu class, for better understanding
    • extend some examples
    • comes with nineoldandroids, need for ripple support if sdk < 16
    Source code(tar.gz)
    Source code(zip)
  • 1.0.7(Mar 8, 2015)

    • smooth drawer close on activity change
    • on section change listener, see new example
    • add and remove sections/menu-items dynamically
    • public reloadMenu method
    • add refresh menu flag, to newSection/newLabel/newDevisor methods
    • more theming
    • extend examples
    • other things

    see the new examples, to test the new features

    Source code(tar.gz)
    Source code(zip)
  • 1.0.6(Mar 7, 2015)

    added option, to override the section and label text size and the section icon size.

    see dimens.xml in the example app or here: https://github.com/madcyph3r/AdvancedMaterialDrawer/issues/1

    Source code(tar.gz)
    Source code(zip)
  • 1.0.5(Mar 3, 2015)

    1. Internal changes: Renamed some classes and moved to a new package, for better understanding. Some small fixes and other changes.
    2. Added option for a label in the menu. See second screenshot.
    3. Added method for easier devisor integration. See all menu example
    4. Other things, i don't remember
    Source code(tar.gz)
    Source code(zip)
  • 1.0.4(Mar 1, 2015)

  • 1.0.3(Feb 25, 2015)

  • 1.0.1(Feb 25, 2015)

  • 1.0(Feb 25, 2015)

    The first official release. To find out all functions, see the example-release.apk To understand the usage, see the example code. It's very easy.

    Have fun with the library ;).

    Source code(tar.gz)
    Source code(zip)
Owner
Marc Schäfers
Marc Schäfers
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.

MaterialDrawer ... the flexible, easy to use, all in one drawer library for your Android project. What's included ?? • Setup ??️ • Migration Guide ??

Mike Penz 11.6k Dec 27, 2022
Navigation Drawer Activity with material design style and simplified methods

MaterialNavigationDrawer Navigation Drawer Activity with material design style and simplified methods       It requires 10+ API and android support v7

Fabio Biola 1.6k Jan 5, 2023
Android drawer icon with material design animation

LDrawer Android drawer icon with material design animation Note Basically same as appcompat_v7 version 21, you can use appcompat_v7 compile 'com.andro

Hasan Keklik 1.4k Dec 25, 2022
Android drawer icon with material design animation

LDrawer Android drawer icon with material design animation Note Basically same as appcompat_v7 version 21, you can use appcompat_v7 compile 'com.andro

Hasan Keklik 1.4k Dec 25, 2022
Animations for Android L drawer, back, dismiss and check icons

Material Menu Morphing Android menu, back, dismiss and check buttons Have full control of the animation: Including in your project compile 'com.balysv

Balys Valentukevicius 2.5k Jan 3, 2023
Implementation of Ripple effect from Material Design for Android API 9+

RippleEffect ExpandableLayout provides an easy way to create a view called header with an expandable view. Both view are external layout to allow a ma

Robin Chutaux 4.9k Dec 30, 2022
Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.

Carbon Material Design implementation for Android 4.0 and newer. This is not the exact copy of the Lollipop's API and features. It's a custom implemen

null 3k Jan 9, 2023
Material Shadows for android : A library for supporting convex material shadows

MaterialShadows A library for seamlessly integrating Material shadows. The library takes existing material shadows to next level by adding the followi

Harjot Singh Oberai 2.2k Dec 19, 2022
A library to bring fully animated Material Design components to pre-Lolipop Android.

Material MaterialLibrary is an Open Source Android library that back-port Material Design components to pre-Lolipop Android. MaterialLibrary's origina

Rey Pham 6k Dec 21, 2022
Material Design icons by Google

Material design icons Material design icons is the official icon set from Google. The icons are designed under the material design guidelines. 4.0.0 U

Google 47.1k Jan 9, 2023
Library containing over 2000 material vector icons that can be easily used as Drawable or as a standalone View.

Material Icon Library A library containing over 2000 material vector icons that can be easily used as Drawable, a standalone View or inside menu resou

null 2.3k Dec 16, 2022
A Material Design ViewPager easy to use library

MaterialViewPager Material Design ViewPager easy to use library Sample And have a look on a sample Youtube Video : Youtube Link Download In your modul

Florent CHAMPIGNY 8.2k Jan 1, 2023
Floating Action Button for Android based on Material Design specification

FloatingActionButton Yet another library for drawing Material Design promoted actions. Features Support for normal 56dp and mini 40dp buttons. Customi

Zendesk 6.4k Dec 26, 2022
EditText in Material Design

MaterialEditText NOTE: 2.0 is NOT BACKWARDS COMPATIBLE! See more on wiki or 中文看这里 AppCompat v21 makes it easy to use Material Design EditText in our a

Kai Zhu 6.1k Dec 30, 2022
A material style progress wheel compatible with 2.3

![](https://img.shields.io/badge/Methods and size-106 | 12 KB-e91e63.svg) Material-ish Progress A material style progress wheel compatible with 2.3 Tr

Nico Hormazábal 2.5k Jan 4, 2023
Material Design ProgressBar with consistent appearance

MaterialProgressBar Material Design ProgressBar with consistent appearance on Android 4.0+. Why MaterialProgressBar? Consistent appearance on Android

Hai Zhang 2.2k Dec 21, 2022
Custom Tabs with Material Design effects

MaterialTabs Custom Tabs with Material Design animations for pre-Lollipop devices       Download example apk It requires 14+ API and android support v

Fabio Biola 1.4k Dec 29, 2022
[] Android Library that implements Snackbars from Google's Material Design documentation.

DEPRECATED This lib is deprecated in favor of Google's Design Support Library which includes a Snackbar and is no longer being developed. Thanks for a

null 1.5k Dec 16, 2022
Showcase of the new AppCompat 21, which includes new Material Theme, working in pre-21 devices.

MaterialEverywhere (deprecated) This example is deprecated, I recommend taking a look at MaterializeYourApp repository. Showcase of the new AppCompat

Antonio Leiva 1.3k Dec 17, 2022