I'm about to use one of them and yet i'm very confused.
I don't know the difference. to me, both look the same.
I've passed through this Difference between SlidingPaneLayout and NavigationDrawer
may anyone tell the difference between them??
This is what the official Navigation Drawer (DrawerLayout) looks like:
And this is what the SlidingPaneLayout looks like:
Both serve different purposes. The DrawerLayout serves as a menu, to put it simple. The SlidingPaneLayout on the other hand is a what you would use, if the content of both your screens would interact with each other. Or to as the documentation puts it:
The SlidingPaneLayout should be thought of only as a way to allow a
two-pane layout normally used on larger screens to adapt to smaller
screens in a natural way
Related
I was wondering if it is possible to implement an expandable menu for NavigationView like we would use with expandable ListView. Right now i am just clueless where to even start.
The NavigationView is purposely limited, so it it likely difficult to customize it in the way you are asking (but not impossible, as anything can be done with enough effort and hacking).
The limited nature of the NavigationView is by design - it is supposed to be the main navigation control for your app, and be very simple. You shouldn't try to customize it in the way you are asking, and instead see if you can fit your navigation into the existing model.
This is designed to be hard to customize, so you will keep it standard (and your app will stay consistent to Material Design standards).
Bottom line, see if you can fit into the existing model, instead of trying to customize it (and thus be non-standard).
I want to use sliding drawer from left to right ?
So can you tell me anybody how it is possible? and also use this drawer to all activity in my project.
Use the concept of viewpager.You can find doc and example below...
doc
Example
Check that library. API 6+ (even less, not quite sure)
https://github.com/6wunderkinder/android-sliding-layer-lib
You can attach a layer to any part of the screen with the addition that you can swipe the layout directly in and out, unlike the SlidingDrawer in which you just can drag from a small piece of UI (drawer).
You could also use the new NavigationDrawer pattern from Google.
http://developer.android.com/design/patterns/navigation-drawer.html
I really don't know what is the difference between these two approaches of creating navigation menu. So I read that both can be used as a container for two fragments (main fragment, detail fragment). So can you help me to understand which approach is better and why? I can't find out relevant information.
thank you.
The session was "Android Design for UI Developers" by Roman Nurik and Nick Butcher:
https://developers.google.com/events/io/sessions/326204977
Pretty much what CommonsWare said, essentially, Navigation Drawer is for chrome and top level navigation, so it overlays app content. SlidingPaneLayout is for content navigation, thus it doesn't overlay content.
EDIT:
The video is still available here - https://www.youtube.com/watch?v=Jl3-lzlzOJI
So can you help me to understand which approach is better and why? I can't find out relevant information.
This was covered in a Google I|O 2013 presentation, though I forget which one.
SlidingPaneLayout is for content, such as the master-detail pattern. You might use it in place of two layouts for master-detail structures for smaller and larger screens.
DrawerLayout is for navigation. You might use it in place of the dashboard pattern, or using action bar items for navigation, if you have a fair bit of navigation in your app.
So I'm using Garuma's FlyOutContainer class in my project (http://blog.neteril.org/blog/2013/04/19/fly-out-menu-xamarin-android/)
But I'm having trouble using the menu to change the content layout. Whenever I remove a view from the content layout and inflate another, it draws the entire content layout at 0, 0 so when the menu layout closes, it drags the content layout past the left edge of the screen as well!
I've been looking for answers and fiddling with this for days now, so I thought I'd ask if anyone here has run into this issue and fixed it as well.
Alternatively, a layout that I could hold static to switch between several other layouts might work as a solution, I just haven't been able to find one that could do so that worked with this FlyOutContainer.
Thanks in advance for any and all replies!
-Sibley
I suggest using the DrawerLayout which Google supplies in the Support.v4 packages, which shows the standardized version of the FlyOut/Sliding/NavMenu which has been implemented in various ways previously, including FlyOutMenu.
I have a sample showing both DrawerLayout and SlidingPaneLayout in my GitHub repo.
One thing to notice is that SlidingPaneLayout is not meant for navigation, while DrawerLayout is. The former is meant as a responsive design, where a Pane's visibility is toggled in portrait mode, while always visible in landscape mode.
I need to incorporate a youtube like drawer navigation drawer for both(left,right) sides. AFAIK android apis don't provide means for the right-to-left drawer functionality. There're quite a lot of implementations out there(sliding menu) which do.
This sliding menu feature seems to present a performance issue. Should I try to rewrite original NavigationDrawer, which I expect to be the least performance-impact solution, or there is another performance-optimal library?
Thanks.
I would choose NavigationDrawer. I used both and I find NavigationDrawer smoother. If you try to mimic google UX then with NavigationDrawer should be enought for your needs.
I recently made a project/demo to implement NavigationDrawer with ActionBarSherlock for pre Honeycomb devices because I need for an app.
SherlockNavigationDrawer impl
Another thing to take in mind is that if you use NavigationDrawer try to avoid Tabs because all the tabs items could fit perfectly as a listview in NavigationDrawer.
Actually NavigationDrawer supports drawers on both edges.
You have to supply the two drawer views inside your layout xml; one with gravity:left and one with gravity:right.
Then, in your Activity you call setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED) on your DrawerLayout object.
This will enable swiping either from left or right edge.
#MichaĆ The question is actually implementation of both left as well as the right drawer.
#midnight NavigationDrawer right now only implements one-sided menu which you can place either on the left or the right. If you want to implement the other pane also you can make your content layout as SlidingPaneLayout.
This was also added to the latest support library along with the NavgationDrawer. For an implemented example you can look at the newest Hangouts app on how they are using it. This layout will probably suit your purposes better rather than rewriting the NavigationDrawer. In any case i'd hold off on re-writing it since it is the first release of the Layout and may undergo changes fairly quickly.
Since the last version of SupportLibrary there is a NavigationDrawer in Android.