neokree / materialnavigationdrawer Goto Github PK
View Code? Open in Web Editor NEWNavigation Drawer Activity with material design style and simplified methods
License: Apache License 2.0
Navigation Drawer Activity with material design style and simplified methods
License: Apache License 2.0
OptionsMenu should be hidden (gone) when the drawer is opened (so toolbar icons will disappear) and recovered when closed (see GMail app for example).
More complicated cases are when a toolbar is changed e.g. multiselect is triggered or search in toolbar is present. In this case, original toolbar without menu icons should appear back when the drawer is opened and specialized multiselect / search / however previously changed toolbar should re-appear when closed back. Try to multiselect some items in GMail app, open/close the drawer & you will see it in action ;)
"Unchecked call to newSection(String, Drawable, Fragment) as a member of raw type"
How to resolve this warning?
How can I show the drawer layout on top of the status bar as shown here?
I found you implement the Drawer and Tab modules in separate projects. In real project, I need the Tabs to support the sub-category views of the main category in the Drawer. And also there are several apps using this models.
So what's your consideration and plan. Thanks.
We can just extend one superclass. Most people extend ActionBarActivity (AppCompat) in order to use the new Toolbar widget. If we can't extend it, we will probably be unable to use the toolbar.
Also, it's much easier to implement the required methods under onCreate(), rather than under init().
Is there way to show navigation drawer below the toolbar? I can't see the arrow drawable while drawer opening.
There are some example of views; https://github.com/kanytu/android-material-drawer-template
It would be great if i choose one of these layouts in my code like;
setDrawerStyle(DrawerStyle.Default);
setDrawerStyle(DrawerStyle.GoogleInbox);
setDrawerStyle(DrawerStyle.PlayStore);
setDrawerStyle(DrawerStyle.Gmail);
and if there was an option to hide profile pic like showProfileImage(false);
also resizing the drawer background would be greak like; http://i.stack.imgur.com/aj5dU.png
I can modify your lib if you are busy send it back to you.
Thanks
According to material design specification:
http://www.google.com/design/spec/patterns/navigation-drawer.html
there is no such thing as a bottom pinned section.
From the spec:
"Settings and support are located at the bottom of the scrolling list, in-line with the rest of the list content."
Inline = following the last items in drawer, not pinned to the bottom - see Google apps.
From the specification - if the list of items in drawer is short:
"If the list doesn’t scroll, the settings and support items will appear at the end of the list and are not pinned."
But it might be OPTIONALY pinned, if a list of items is very long, from the spec:
"If the list of content in the navigation drawer is very long, the two options can be pinned to the bottom of the navigation drawer on a surface with a higher elevation. This surface is present only while at the top of the list; any other scroll position will immediately result in dismissing the surface and placing the options at the end of the list, in-line with the rest of the list content. The navigation drawer retains its scroll position when closed and reopened."
So pinning to bottom is OPTIONAL only in case of so many items that scrolling is enabled (but not even Google apps does that). Moreover, in this very specific OPTIONAL scenario, it should appear pinned only when not scrolled, and dissappear while scrolling.
Well, as per spec Roboto font should be used everywhere in the drawer (by def). However, setting font's isn't esiest in Android - usually done thru extending original Views classes, creating (libs with) custom ones. Everybody does it differently, some use libraries, some handle it in their app alone...
Thus, it would be gr8 to let implementation use the most commond Roboto libs like:
https://github.com/johnkil/Android-RobotoTextView
https://github.com/eeVoskos/RobotoViews
or use developer provided font resource internally in lib, avoiding unnecessary, possibly duplicate assets (if utilizing own font as asset in lib). If lib / font asset would not be provided (developer doesn't care), default font might be used as now.
I am reading through the new Material Design Spec and the Material Design Checklist.
The spec says that the slide out pane should float above everything else including the status bar and be semi-transparent over the status bar.
From the screenshots of your implementation it doesn't look like it has transparency.. I just wanted to know if that is left to the user to implement or is something you still have to implement yourself?
thanks for the help,
Hello!
I just want to start by saying that this is an awesome library. The first I've seen to actually get the specs right and the methods you've implemented are really making my life a breeze. :)
Anyway, I need to use a section with a MaterialSectionListener and tried this:
this.addSection(this.newSection("Title", new MaterialSectionListener() {
@Override
public void onClick(MaterialSection section) {
// Doing some stuff here, then opening another activity
}
}));
However, that throws this exception:
java.lang.RuntimeException: Fragment must be android.app.Fragment or android.support.v4.app.Fragment
at it.neokree.materialnavigationdrawer.MaterialNavigationDrawer.setFragment(MaterialNavigationDrawer.java:397)
at it.neokree.materialnavigationdrawer.MaterialNavigationDrawer.onClick(MaterialNavigationDrawer.java:566)
at it.neokree.materialnavigationdrawer.MaterialSection.onTouch(MaterialSection.java:107)
Is this me missing something obvious or is it a bug? 😄
Hi, Great job! How I can have the same drawer in other activities which is targeted from menu sections?
Hi,
I'm trying to implement this library in my product, but for implementing your library I need to use MaterialDrawer
class but my product already has it's own classes which inherit the ActionBarActivity
class.
So can this library have a different model, I mean a Decoupled model
I'm having trouble getting a working copy of my clone of this project to edit it myself. Since the project has a minimum version of 14 there's no reason to use support fragments and just use android.app.Fragment instead. Since my settings fragment is based on PreferenceFragment, I can't launch it using the navigationdrawer. PreferenceFragment didn't make it into the support library.
Hi,
I am using a dark colorPrimary, and the elements in the toolbar are black, while they should be white to contrast with the dark toolbar. Also the title and any menu actionviews are black. I guess this is because your parent theme is set to Light? Would it be possible to have also a dark implementation of your library? Or can you suggest what I could do to remedy the issue?
thanks!
It will be nice to have RTL support so the lib can be more generic (as 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.
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!
java.lang.RuntimeException: Unable to start activity ComponentInfo{it.neokree.materialnavigationdrawer/it.neokree.example.MainActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment it.neokree.example.MainActivity$FragmentIndex: make sure class name exists, is public, and has an empty constructor that is public
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3576)
at android.app.ActivityThread.access$800(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment it.neokree.example.MainActivity$FragmentIndex: make sure class name exists, is public, and has an empty constructor that is public
at android.support.v4.app.Fragment.instantiate(Fragment.java:431)
at android.support.v4.app.FragmentState.instantiate(Fragment.java:101)
at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1823)
at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:264)
at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:122)
at it.neokree.materialnavigationdrawer.MaterialNavigationDrawer.onCreate(MaterialNavigationDrawer.java:70)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3576)
at android.app.ActivityThread.access$800(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.InstantiationException: can't instantiate class it.neokree.example.MainActivity$FragmentIndex; no empty constructor
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.support.v4.app.Fragment.instantiate(Fragment.java:420)
at android.support.v4.app.FragmentState.instantiate(Fragment.java:101)
at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1823)
at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:264)
at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:122)
at it.neokree.materialnavigationdrawer.MaterialNavigationDrawer.onCreate(MaterialNavigationDrawer.java:70)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3576)
at android.app.ActivityThread.access$800(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
Hi,
I am working on a full screen app.
Can i use this lib with out action bar ?
Thanks
There are only few methods that doesn't support API 10, and they are easy to backport.
Check this:
https://github.com/yoavst/MaterialNavigationDrawer/commit/4fef353f693f4183a7855f5159362427feeaeb31
// Somewhere in the code you get the height, so you can use that.
int getHeight() {
int height = 0;
Display display = getWindowManager().getDefaultDisplay();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
Point size = new Point();
display.getSize(size);
height = size.y;
} else {
height = display.getHeight(); // deprecated
}
return height;
}
// When you set alpha, use that method.
void setAlpha(View v, float alpha) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
v.setAlpha(alpha);
} else {
AlphaAnimation animation = new AlphaAnimation(alpha, alpha);
animation.setDuration(0);
animation.setFillAfter(true);
v.startAnimation(animation);
}
}
And on versions lower then v11, just don't do the animation:
private void switchAccounts(final MaterialAccount newAccount) {
final ImageView floatingImage = new ImageView(this);
// si calcolano i rettangoli di inizio e fine
Rect startingRect = new Rect();
Rect finalRect = new Rect();
Point offsetHover = new Point();
// 64dp primary user image / 40dp other user image = 1.6 scale
float finalScale = 1.6f;
final int statusBarHeight;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
statusBarHeight = (int) (25 * density);
} else {
statusBarHeight = 0;
}
// si tiene traccia della foto cliccata
ImageView photoClicked;
if (newAccount.getAccountNumber() == MaterialAccount.SECOND_ACCOUNT) {
photoClicked = userSecondPhoto;
} else {
photoClicked = userThirdPhoto;
}
photoClicked.getGlobalVisibleRect(startingRect, offsetHover);
floatingImage.setImageDrawable(photoClicked.getDrawable());
// si aggiunge una view nell'esatta posizione dell'altra
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(photoClicked.getWidth(), photoClicked.getHeight());
params.setMargins(offsetHover.x, offsetHover.y - statusBarHeight, 0, 0);
drawer.addView(floatingImage, params);
// si setta la nuova foto di profilo sopra alla vecchia
photoClicked.setImageBitmap(currentAccount.getCircularPhoto());
// si setta la nuova immagine di background da visualizzare sotto la vecchia
usercoverSwitcher.setImageBitmap(newAccount.getBackground());
userphoto.getGlobalVisibleRect(finalRect);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
// Si calcola l'offset finale (LARGHEZZA DEL CONTAINER GRANDE - LARGHEZZA DEL CONTAINER PICCOLO / 2) e lo si applica
int offset = (((finalRect.bottom - finalRect.top) - (startingRect.bottom - finalRect.top)) / 2);
finalRect.offset(offset, offset - statusBarHeight);
startingRect.offset(0, -statusBarHeight);
// si animano le viste
AnimatorSet set = new AnimatorSet();
set
// si ingrandisce l'immagine e la si sposta a sinistra.
.play(ObjectAnimator.ofFloat(floatingImage, View.X, startingRect.left, finalRect.left))
.with(ObjectAnimator.ofFloat(floatingImage, View.Y, startingRect.top, finalRect.top))
.with(ObjectAnimator.ofFloat(floatingImage, View.SCALE_X, 1f, finalScale))
.with(ObjectAnimator.ofFloat(floatingImage, View.SCALE_Y, 1f, finalScale))
.with(ObjectAnimator.ofFloat(userphoto, View.ALPHA, 1f, 0f))
.with(ObjectAnimator.ofFloat(usercover, View.ALPHA, 1f, 0f))
.with(ObjectAnimator.ofFloat(photoClicked, View.SCALE_X, 0f, 1f))
.with(ObjectAnimator.ofFloat(photoClicked, View.SCALE_Y, 0f, 1f));
set.setDuration(USER_CHANGE_TRANSITION);
set.setInterpolator(new DecelerateInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onSwitchAcountAnimationEnd(newAccount, floatingImage);
}
@Override
public void onAnimationCancel(Animator animation) {
// se si annulla l'animazione si conclude e basta.
onSwitchAcountAnimationEnd(newAccount, floatingImage);
}
});
set.start();
} else onSwitchAcountAnimationEnd(newAccount, floatingImage);
}
void onSwitchAcountAnimationEnd(MaterialAccount newAccount, ImageView floatingImage) {
// si carica la nuova immagine
setAlpha(userphoto, 1);
setFirstAccountPhoto(newAccount.getCircularPhoto());
// si cancella l'imageview per l'effetto
drawer.removeView(floatingImage);
// si cambiano i dati utente
setUserEmail(newAccount.getSubTitle());
setUsername(newAccount.getTitle());
// si cambia l'immagine soprastante
setDrawerBackground(newAccount.getBackground());
// si fa tornare il contenuto della cover visibile (ma l'utente non nota nulla)
setAlpha(usercover, 1);
// switch numbers
currentAccount.setAccountNumber(newAccount.getAccountNumber());
newAccount.setAccountNumber(MaterialAccount.FIRST_ACCOUNT);
// change pointer to newAccount
currentAccount = newAccount;
// si chiude il drawer
if (!deviceSupportMultiPane())
layout.closeDrawer(drawer);
}
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:
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
Admirably, nav drawer is just not only for setting fragments / activities.
There are TON of use cases when app needs to have some custom logic and based on it, decide what will be done. E.g. sometimes, I need to check if there is added user / items I want to show so I trigger usual fragment, or just show placeholder, dialog or sth. Also Google apps need that - they trigger dialogs, open websites in some cases, trigger activity for result or some need to react if user has a conenction or not etc... list goes on and oooon.
More flexibility is clearly needed for an action which happens on drawer item click (selected) to allow user define custom action.
SOLUTION:
Currently because of that, I use an older version of a lib as a project mobule lib :-/ with a custom section constructors, custom section listener (extending the same MaterialSectionListener you already have) and I set it like section.setCustomOnClickListener and have some more logic to handle that... If set, I trigger this listener at the end of onClick impl in MaterialNavigationDrawer class, of course, not setting a new frag / activity previously, but letting a developer to do what's needed.
@neokree I would like to contribute to solve this, as this is almost the BIGGEST limitation this lib now has & it would be great to solve it asap. My approach doesn't have to be the best, but it works and it's kinda easy. Do not hesitate to contact me directly to figure this out (and also to test your newest features / imporvements before releasing them) ;)
Hi!
First of all, thank you for your great job.
I came across a little problem while implementing this drawer.
When I declare sections inside addSection(), no problem.
But when I try to declare them beforehand as the following:
//create sections and associated fragments
mainSection = this.newSection("Home", getResources().getDrawable(R.drawable.ic_home_grey600_48dp), new MainFragment());
pendingShares = this.newSection("Pending shares",getResources().getDrawable(R.drawable.ic_database_grey600_48dp),new PendingSharesFragment()).setNotifications(10);
shareSection = this.newSection("Share", this.getResources().getDrawable(R.drawable.ic_share_grey600_48dp), new ShareFragment()).setSectionColor(Color.parseColor("#2196f3"));
alarmSection = this.newSection("Alarms",getResources().getDrawable(R.drawable.ic_alarm_grey600_48dp), new AlarmFragment()).setSectionColor((Color.parseColor("#ff9800")));
profileSection = this.newSection("Profile", getResources().getDrawable(R.drawable.ic_account_grey600_48dp), new ProfileFragment());
settingsSection = this.newBottomSection("Settings",this.getResources().getDrawable(R.drawable.ic_cog_grey600_48dp),new Intent());
// add sections
this.addSection(mainSection);
this.addSection(pendingShares);
this.addSection(shareSection);
this.addDivisor();
this.addSection(alarmSection);
this.addSection(profileSection);
this.addBottomSection(settingsSection);
the drawer items remain highlighted when I navigate between sections.
Should I instantiate sections manually using new MaterialSection()
?
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.
on 5.0+ the background should be ripple
Because the library doesn't allow you to directly change the Toolbar in XML I had to change my style in order to have a light theme with a Dark Actionbar. The following style could be used to implement such a feature.
<style name="MaterialNavigationDrawerTheme.Light.DarkActionbar" parent="Theme.AppCompat.Light">
<item name="android:windowTranslucentStatus">true</item>
<item name="windowActionBar">false</item>
<item name="theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="popupTheme">@style/Base.V21.Theme.AppCompat.Light.Dialog</item>
<item name="android:textColorSecondary">@android:color/white</item>
</style>
The problem with this is that <item name="android:textColorSecondary">@android:color/white</item>
will still be global but it's better than nothing.
i want to chage the icon color when i select the section
how can this be possible?
this.getSupportActionBar()
returns null in init()
when called in a class extending MaterialNavigationDrawer
Note:
I was able to call it in
onPostCreate(Bundle savedInstanceState)
but normally you should be able to call this in onCreate()
.
I know it's a choice from you to let the statusbar background (colorPrimary) be tinted with the translucent filter of KitKat statusbar.
But I think that colorPrimaryDark as background feels more like Lollipop devices, even when tinted.
Hello,
You really did a great job with this library, this made the app code much more clearer and with minimal boilerplate code, thank you for that :)
Want to ask if there's an option to allow the side drawer to go under the toolbar, or are you planning to add it. I previously have done this by adding a top margin to the drawer layout view with heigh equals to the actionbar size. Many of Google apps are still doing this this way even though they're update to the material design (like the new Calendar app or the Google drive app for instance), and I prefer it this way personally.
Is it possible to have the library uploaded to Maven Central ?
As per spec (and also seen in Google apps like GMail or Inbox), drawer allowes subheaders:
http://www.google.com/design/spec/patterns/navigation-drawer.html
Subheader: Roboto Medium, 14sp, 54% #000000. Aligns to the 16dp keyline.
It has special alignment, no icon, no clickable / selectable state (pure TextView is enough).
It could be found only just below a sections divider to tell the new section name or describe its following content / purpose. Usually it's used for specific or user defined sections, not the main navigation / first section, but to tell content / sections apart in longer nav drawers.
In landscape mode, drawer width is totally wrong - should be of the same width as in portrait (see Gogole apps) - I know, official Material design guidelines are kinda wrong in this regard.
This causes that drawer's "acount background image" is extremely huge (it should be of the same size as in portrait, because drawer should be the same wide as well).
Moreover, in landscape, account info (text) has wrong padding and accounts photos are completely displaced - aligned to the very top of the drawer.
The next common error for toolbar impl. is wrong text size and alignment of toolbar title in landscape.
It's too small and incorrectly aligned according to toolbar icons.
However official Material design guidelines specify:
"The nav drawer spans the full height of the screen and the drawer is below the status bar."
there is a general rule appearing in all Google apps as well as in all apps updated to Material Design specs, that there is nothing under statusbar in pre-Android L versions.
This behaviour is very specific for Android L that in many cases it doesn't even look good on KitKat for example. Even fake statusbar gradient doesn't look good on this devices compared to Anroid L, which uses colorPrimaryDark for this purpose (statusbar). Btw, you should also use colorPrimaryDark from styles, not calculate it. colorPrimaryDark is supported by appCompat as well.
Please, at least, add an option to not put it under statusbar for pre-Android L devices.
As per Material Design guidelines (and also in Google apps like GMail for a reference)
http://www.google.com/design/spec/patterns/navigation-drawer.html
ordinary drawer item icons (and "notifications") should be of one specific color in non selected state and that is 54% #000000, not black, nor custom colored. However text in some apps appears to be black, as per spec (guidelines) it should be 87% #000000.
When selected, icon and text in such ordinary item should become 100% black or of a custom color for a better contrast (SectionColor now in your case) and item should have a gray BG, as it already has.
See selection state in specs:
http://www.google.com/design/spec/patterns/navigation-drawer.html
How "notifications" should be colored in selected state isn't specified, but judging from GMail app, they still stay gray (no matter section has a custom color or not).
In some rare cases, coloring an icon has it's meaning (check GMail labels), but this icons shouldn't be the ones for a primary navigation purposes. BUT, text & notification colors should remain not changed in this case.
I advice to set & kinda enforce this default colors, make section color -> section icon color and add section selected color as a highlight color, if user would like to override default (and of course handle open/close re-coloring cases).
Lastly, custom coloring of section items in selected state (usually the same custom color for all items) doesn't have to affect fragment's toolbar color (by default it doesn't). It's nice feature, but should be optional for a better flexibility.
PS: drawer items (sections in this lib case) default background color shouln't be white, but #fafafa.
Thanks for the fantastic work so far. This library is very helpful.
I wonder if it would be possible to add backward compatibility for API level 7. As far as I have seen there are only few methods (e.g. setColorFilter()
) and classes (e.g. android.app.Fragment
) that are not available in API level 7.
Maybe a check against android.os.Build.VERSION
counld do the trick?
there is a bug in the drawer
when i touch a section in nav drawer (not just touch but touch and swipe) it acts like it touched
and it seems to be there is more than one section opened
sorry form my bad english
Hi, I followed your example but I keep getting a NullPointer exception.
Caused by: java.lang.NullPointerException
at it.neokree.materialnavigationdrawer.MaterialNavigationDrawer.onCreate(MaterialNavigationDrawer.java:132)
This happens both, in my app and in your example app as well running on Android 4.1.1.
For example, if you want the "account" bar to show the text "Sign up now", you just use a background and a title (no need to use a photo and a secondary text). But it's apparently impossible to do that with the available methods.
For not using AppCompat theme
why it stuck on back press? and when I add super.onBackPressed(); it throws indexoutofbounds exception!
There is a learning pattern associated with the nav drawer nature, as it is something people don't see (and some don't know it's there) until it's open. Basically what Google recommends is to open the nav drawer when starting your app everytime until user himself / herself firstly tap / swipe to open the drawer = they finally got it how it works and that it's there. It seems like pretty obvious to us, but there are some users that must be taught to do that (unfortunatelly).
If you generate a new project in Android Studio with a drawer pattern, it is already implemented there, so check it out - just one SharedPref variable, that's it ;)
How do you set the account picture if the drawable first needs to be grabbed from the web? I tried to set a filler picture and then call account.setPhoto() after the async task is completed but it didn't work.
I know you can download the example.apk but it would be really good to provide the source code of the example application. Doing so, we'll be able to check how to implement the library even better.
In certain scenarios you want an activity to change the title of the actionbar dynamically (not only at the start). But after returning back from the navigation menu it overrides whatever title you set earlier with the original title defined in newSection("Title",new WhateverFragment())
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.