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
:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion

FOLDING CELL [JAVA] Expanding content cell with animation inspired by folding paper card material design. We specialize in the designing and coding of

Ramotion 4.9k Dec 7, 2022
swipe display drawer with flowing & bouncing effects.

FlowingDrawer swipe right to display drawer with flowing effects. Download Include the following dependency in your build.gradle file. Gradle: rep

mxn 2.6k Jan 3, 2023
Visual back-port of the rotating drawer-to-arrow drawable from Android L

DrawerArrowDrawable A simple drawable backport of the new drawer-indicator/back-arrow rotating drawable from the upcoming Android L. License Copyright

Chris Renke 827 Nov 25, 2022
Easily add slide to dismiss functionality to an Activity

Slidr Easily add slide-to-dismiss functionality to your Activity by calling Slidr.attach(this) in your onCreate(..) method. Usage An example usage: pu

Drew Heavner 2.7k Dec 29, 2022
SwipeBack is an android library that can finish a activity by using gesture.

SwipeBack SwipeBack is a android library that can finish a activity by using gesture. You can set the swipe direction,such as left,top,right and botto

Eric 1.7k Nov 21, 2022
Animate your activity!

Warning This library is not in development anymore, but we are accepting PRs or successors if anyone is interested. If you want to use these transitio

Pedro Paulo Amorim 1.3k Dec 4, 2022
ViewHelper to provide one activity applications

PrismView provides animations for your views, similar to Dragger, but with fragments! You can change the fragment of the PrismView any time. Usage Ext

Pedro Paulo Amorim 149 Apr 24, 2022
Android Activity 滑动返回。支持微信滑动返回样式、横屏滑动返回、全屏滑动返回

?? BGASwipeBackLayout-Android ?? 强烈建议与 StatusBarUtil 结合着一起使用 常见问题与反馈 1.使用透明主题时,滑动返回看见了 Launcher 保证栈底 Activity 的主题是不透明的。例如 demo 中的首个 Activity 是 SplashA

王浩 2.3k Nov 25, 2022
Repositório para criar layouts e chamar na activity main e melhorar um dos pontos fracos meu (layout).

Repositório para criar layouts e chamar na activity main e melhorar um dos pontos fracos meu (layout). Não se preocupe com os tipos malucos de layouts

Murillo Alves da Silva 1 Dec 14, 2021
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
A layout to transition between two views using a Floating Action Button as shown in many Material Design concepts

⚠ This library is no longer maintained ⚠️ FABRevealLayout A layout to transition between two views using a Floating Action Button as shown in many Mat

Tomás Ruiz-López 901 Dec 9, 2022
An implementation of tap targets from the Material Design guidelines for feature discovery.

TapTargetView An implementation of tap targets from Google's Material Design guidelines on feature discovery. Min SDK: 14 JavaDoc Installation TapTar

Keepsafe 5.2k Jan 9, 2023
Material Design tap target for Android. https://sjwall.github.io/MaterialTapTargetPrompt/

Material Tap Target Prompt A Tap Target implementation in Android based on Material Design Onboarding guidelines. For more information on tap targets

Sam Wall 1.5k Dec 29, 2022
Material Design Search View Layout, now implemented in Google Maps, Dialer, etc

THIS PROJECT IS DEPRECATED Component is not maintained anymore. Implementation of Lollipop+ Dialer and Google Maps. DEMO Add in View Add to your layou

Sahil Dave 1.1k Dec 22, 2022
iOS 7/8 style side menu with parallax effect.

RESideMenu iOS 7/8 style side menu with parallax effect inspired by Dribbble shots (first and second). Since version 4.0 you can add menu view control

Roman Efimov 7.2k Dec 28, 2022
Maetrial Design Delete Concept Implement

MaterialDeleteLayout 说明 早上逛github的时候,发现ParticleLayout这个开源项目,觉得这个创意还可以... 从说明中又点进去看IOS的效果,也从那里看到了原设计图... 原设计图是这样子的: IOS的效果是这样的: 那一刻感觉android的效果lower了好多

CJJ 355 Nov 19, 2022
Smooth version of Google Support Design AppBarLayout

smooth-app-bar-layout [Deprecated] ================ [DEPRECATED] The issue that is addressed in this library is fixed from support design 26.0.0 or ab

Henry Tao 1.8k Dec 13, 2022
A simple customised version of the TextInputLayout from the Android Design Support Library ⌨️

Buffer Text Input Layout (Coming to maven central soon!) This is a simple customisation of the TextInputLayout found in the Design Support Library. Wh

Buffer 988 Nov 24, 2022
Pixel perfect for design layout android

Pixelperfect Pixel perfect helps you design layouts according to the resolution of your users' device Follow the steps below to implement : dependen

null 10 Oct 23, 2022