Navigation Drawer Activity with material design style and simplified methods

Overview

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.
Comments
  • cannot touch in content in DrawerLayout.LOCK_MODE_LOCKED_OPEN

    cannot touch in content in DrawerLayout.LOCK_MODE_LOCKED_OPEN

    in tablet 7-inch landscape or larger device, you setDrawerLockMode, so you can't touch in content. I think this is solution: http://derekrwoods.com/2013/09/creating-a-static-navigation-drawer-in-android/ I tried and it work for me.

    checking if problem is resolved 
    opened by ht1990 22
  • Drawer doesn't react when you scrolled in ListView

    Drawer doesn't react when you scrolled in ListView

    Layout: I have a RecyclerView in a Fragment. This Fragment is bound to the first section of the drawer. In the RecyclerView are 50000 entries.

    Problem: I can not open the drawer with the left to right swipe when I touched the RecyclerView to scroll. Since I scrolled, I have to touch the hamburger menu to open the drawer. And when it is open(and I scrolled before) I can only close it when I touch on the back button or I select a section. No swipe or no tap on the empty space on the right of the drawer.

    When I opened the drawer(and I scrolled before) you can scroll the RecyclerView when you touch the space to the right of the drawer. That is the space, where you can see the RecyclerView. You can see that in the video at the end of this post. The scrollbar in the top right shows, that the RecyclerView scrolls.

    To fix that problem, you have to restart the app. But with the next touch on the RecyclerView to scroll, it is broken.

    I can reproduce this issue. You only have to

    -create new project -implement the drawer -create a Fragment with ReycyclerView -create an adapter and a ViewHolder for the RecyclerView -in code, create a new instance of your adapter with min 100 items(so you can scroll)

    Edit: The problem is the ListView. So, it doesn't react whith ListView and RecyclerView(extends from ListView).

    Tested on Nexus 6, Nexus 6 emulator and Note 2. Demo on Note 2: https://www.youtube.com/watch?v=qSNQ5B5HT60

    bug available in the next release 
    opened by randombyte-developer 19
  • Action bar not expanding on Landscape mode

    Action bar not expanding on Landscape mode

    These are images from the sample than im testing: When the app is in portrait mode works fine but when changes to landscape the menu is shown but when it hides the fragment within don't resize.

    https://www.dropbox.com/sh/x4jg0cdp27o67q2/AACUXEUyOpqWU3X_onoizkuPa?dl=0

    checking if problem is resolved 
    opened by CoericK 18
  • Out of memory errors

    Out of memory errors

    When running the app on my smartphone (galaxy S5), A crash happens because of an out of memory error. This error always happens at init function, when running the MaterialAccount constructor, at the stage of loading the navigation drawer background photo. The crash happens while doing one of the following:

    1. When rotating the phone to landscape mode.
    2. When exiting the app with back button and starting the app again

    Using memory monitor in Android studio, memory usage goes up to 200Mb, then the crash happens.

    I think the reason for the crash is allocating too much memory for the Bitmaps. When rotating the phone, or exiting, then re-entring, it might be the garbage collector didn't dispose all the bitmaps that was allocated before (when previously running the MaterialAccount constructors), thus causing the crash when allocating again.

    I think 2 steps might help here:

    1. Dispose allocated memory with nulling the pointer in "onStop()"
    2. Better manage bitmaps

    The following docs can help here:

    1. https://developer.android.com/training/articles/memory.html which also mention to "Avoid wasting memory with bitmaps".
    2. https://developer.android.com/training/displaying-bitmaps/manage-memory.html
    checking if problem is resolved 
    opened by yanivagman 18
  • No account drawer

    No account drawer

    There are apps that don't need a user to be logged in. In such case, in "account area" there is just a text of a size "abc_text_size_headline_material" - usually by def white, with some background, usually only a color (accent in some apps). Nothing else, pretty simple.

    checking if problem is resolved 
    opened by mkosik 18
  • SoftInputMode=

    SoftInputMode="adjustResize" doesn't work with MyNavigationDrawerTheme

    Hi! I noticed that Android can't resize the activity when SoftKeyboard is opened if I'm using your DrawerTheme. All works fine with Lollipop's default theme (applied in styles.xml).

    Activity with default theme: screenshot_2015-03-08-20-25-37

    Activity with MyNavigationDrawerTheme: screenshot_2015-03-08-20-24-52 EditText is below the Soft Keyboard, so the activity wasn't resized.

    Best regards, Paolo

    under investigation 
    opened by paolorotolo 17
  • back button support

    back button support

    Hi,

    First, I want to thank you for doing such a great work. This lib is great and helps a lot. I encountered few issues when using back button, Please take a look at the following if possible:

    1. If I exit the app with back button, the next time I start the app causes a crash
    2. Using back button will exit the app, instead of getting back to the previous screen (in google apps, the behavior is to get back to the main screen, then another "back" press leads to app exit)
    3. Opening a new fragment from the drawer (like settings fragment), then hitting back, will cause us to get back to the previous screen as it should, however, the selected list item will still be settings, instead of the previous item selected.

    One more small issue here, not related to back button, is RTL support. It will be nice to have this feature (explained at http://android-developers.blogspot.co.il/2013/03/native-rtl-support-in-android-42.html). Essentialy, there are two steps involved: adding android:supportsRtl="true" to the element in manifest file and changing (or adding if min sdk is lower than 17) "start" instead of "left" and "end" instead of right.

    Thanks again, Yaniv

    testing 
    opened by yanivagman 13
  • NullPointerException in onCreate

    NullPointerException in onCreate

    Hello, I got a NullPointerException after I return in activiity that extends MaterialNavigationDrawer

    Caused by: java.lang.NullPointerException at it.neokree.materialnavigationdrawer.MaterialNavigationDrawer.onCreate(MaterialNavigationDrawer.java:678) at android.app.Activity.performCreate(Activity.java:5372) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)             at android.app.ActivityThread.access$700(ActivityThread.java:159)             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)             at android.os.Handler.dispatchMessage(Handler.java:99)             at android.os.Looper.loop(Looper.java:176)             at android.app.ActivityThread.main(ActivityThread.java:5419)             at java.lang.reflect.Method.invokeNative(Native Method)             at java.lang.reflect.Method.invoke(Method.java:525)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)             at dalvik.system.NativeStart.main(Native Method)

    opened by BackPackerDz 12
  • Master/detail flow

    Master/detail flow

    Hello. Is there a possibility to use this lib with master/detail on tablets? I want to have 2 panes in normal and 3 in existing multipane mode. Thanks!

    checking if problem is resolved request 
    opened by pawelantczak 12
  • Fragments overlapping?

    Fragments overlapping?

    Hello again, I implemented your library mostly successfully (thanks, you are doing a great job btw) but when I replace the FragmentIndex of your example with 3 different fragments, what I see is that the fragments overlap? So I can still see fragment1 when I should only see fragment2. You don't see that in your example code because your fragments are all instances of FragmentIndex, so they are identical. In your implementation, are the fragments added, or are they replacing previous fragments?

    thanks for the clarification!

    bug work in progress 
    opened by nmesisca 12
  • java.lang.IndexOutOfBoundsException when selecting section from child

    java.lang.IndexOutOfBoundsException when selecting section from child

    Hi Folks,

    I get the following exception when changing to another section from a child section:

    java.lang.IndexOutOfBoundsException
                at java.util.LinkedList.remove(LinkedList.java:660)
                at it.neokree.materialnavigationdrawer.MaterialNavigationDrawer.setFragment(MaterialNavigationDrawer.java:968)
    

    My code to change to a section is as following:

    public void selectSection(final Class<? extends BaseFragment> targetFragmentClazz) {
            final MaterialSection currentSection = getCurrentSection();
            final MaterialSection targetSection = getSection(targetFragmentClazz);
            currentSection.unSelect();
            setFragment(targetSection.getTargetFragment(), targetSection.getTitle());
            setSection(targetSection);
            targetSection.select();
        }
    

    Edit:

    After doing some investigation, it seems to me that the problem is here in this line ' else for(int i = childFragmentStack.size()-1;i >= 0;i++)' in the following method:

    /**
         * Set the fragment to the activity content.<br />
         * N.B. If you want to support the master/child flow, please consider to use setFragmentChild instead
         *
         * @param fragment to replace into the main content
         * @param title to set into Toolbar
         */
        public void setFragment(Fragment fragment,String title) {
            setFragment(fragment,title,null);
    
            if(!isCurrentFragmentChild) {// remove the last child from the stack
                childFragmentStack.remove(childFragmentStack.size() - 1);
                childTitleStack.remove(childTitleStack.size() - 1);
            }
            else for(int i = childFragmentStack.size()-1;i >= 0;i++) { // if a section is clicked when user is into a child remove all childs from stack
                childFragmentStack.remove(i);
                childTitleStack.remove(i);
            }
    
            // add to the childStack the Fragment and title
            childFragmentStack.add(fragment);
            childTitleStack.add(title);
    
            isCurrentFragmentChild = false;
        }
    

    Perhaps the loop need to be:

     for(int i = childFragmentStack.size()-1;i >= 0;i--)
    
    bug testing 
    opened by vangliana 10
  • add number besides a fragmnet name & add Admob show

    add number besides a fragmnet name & add Admob show

    I want to add a number besides a fragment name. In the demo picture you shows that there have a number. but i can't find it how to put number.

    In the normal sliding menu we can use admob ad for all fragment. but if i used this how i can show admob ad??

    opened by pavelsust 0
  • Change header background

    Change header background

    I'd like to change the header background. From what I saw in the library, it only considers images...I don't want to use an image, I just want to have a different color at the header layout i.e a header layout with red color and sections layout with white color.. How do I accomplish that ??

    opened by ClaudeHangui 0
  • Not working

    Not working

    Im new to android, and I am downloding it and enter the dependencies in androidmanifest.xml and replace all your main folder files with my new project file but it is not working please tell some suggestion.

    opened by merbin2012 1
  •  change the font size

    change the font size

    Hello, I would like to know how to change the font size, I'm using a tablet 7 "I think the letter is very small. Give thanks for the Neokree the library, help me a lot.

    opened by FahedHermoza 0
  • Section title color method

    Section title color method

    can i change section title color as programmatical way ? not from style i cannot found method for changing sectionTextColor() please help @neokree :)

    opened by abdymm 2
Owner
Fabio Biola
Fabio Biola
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
Custom drawer implementation for Material design apps.

material-drawer Custom drawer implementation for Material design apps. Demo A demo app is available on Google Play: Screenshots Fixed items Select pro

Jan Heinrich Reimer 600 Nov 18, 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
A Gmail-like Material Drawer implementation

AdvancedMaterialDrawer A Gmail-like Material Drawer implementation Based on neokree's MaterialDrawer library, but they are not the same. I have made m

Marc Schäfers 200 Oct 27, 2022
Default colors and dimens per Material Design guidelines and Android Design guidelines inside one library.

Material Design Dimens Default colors and dimens per Material Design guidelines and Android Design guidelines inside one library. Dimens Pattern: R.di

Dmitry Malkovich 1.4k Jan 3, 2023
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 style circular progress bar for Android

Material CircularProgressView Indeterminate Determinate Description This CircularProgressView is a (surprisingly) circular progress bar Android View t

Rahat Ahmed 760 Nov 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 style morphing play-pause drawable for Android

Play There is no need to explain what this thing does, just take a look at the gif below. Including in your project Add to your root build.gradle: all

Alexey Derbyshev 58 Jul 11, 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
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
Android Sample Project with Material Design and Toolbar.

AndroidMaterialDesignToolbar -- PROJECT IS NOT SUPPORTED Android Sample Project with Material Design and Toolbar. Project use Appcompat library for ma

kemal selim tekinarslan 713 Nov 11, 2022
Modular and customizable Material Design UI components for Android

Material Components for Android Material Components for Android (MDC-Android) help developers execute Material Design. Developed by a core team of eng

Material Components 14.4k Dec 31, 2022
Easy creation and management of toggle buttons on Android from the Material Design spec.

ToggleButtonLayout Easy creation and management of toggle buttons from the Material Design spec. Read more about ToggleButtonLayout in our blog post.

Savvy 229 Jan 9, 2023
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
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