How can I create a horizontal sliding drawer like the YouTube and Facebook app has.
Many other apps seem to use use the same style, so I'm guessing that this is a part of the default Androind UI framework but I can't seem to piece it together.
You can see some more samples here.
Thanks.
This is a sliding menu, you can implement this by writing a custom view. There are a lot of good open source examples. I would recommend you to use this one.
You can use it by defining this in your Layout:
<com.slidingmenu.lib.SlidingMenu
xmlns:sliding="http://schemas.android.com/apk/res-auto"
android:id="#+id/slidingmenulayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
sliding:viewAbove="#layout/YOUR_ABOVE_VIEW"
sliding:viewBehind="#layout/YOUR_BEHIND_BEHIND"
sliding:touchModeAbove="margin|fullscreen"
sliding:touchModeBehind="margin|fullscreen"
sliding:behindOffset="#dimen/YOUR_OFFSET"
sliding:behindWidth="#dimen/YOUR_WIDTH"
sliding:behindScrollScale="#dimen/YOUR_SCALE"
sliding:shadowDrawable="#drawable/YOUR_SHADOW"
sliding:shadowWidth="#dimen/YOUR_SHADOW_WIDTH" />
Edit:
The Android team introduced an official sliding pattern on Google IO 2013. Read everything about it here.
As far as I know it is not part of the default framework. This is the only place I can find it mention in the Android docs http://developer.android.com/design/patterns/actionbar.html and I have search quite a bit.
This so far has been my favorite library https://bitbucket.org/verdigo/drawer/ straight forward and easy to use.
Also pretty recently HoloEverywhere library added a drawer you can use. This one interests me since I use HoloEverywhere in most of my apps and it looks very similar to Foursquares. https://github.com/Prototik/HoloEverywhere
How can I create a horizontal sliding drawer like the YouTube and Facebook app has.
FYI: These are not sliding drawer. That is Navigation Drawer. You can create a Navigation drawer by following this sample project.
Related
I need a navigation bar that doesn't slideIn above the current view (the usual overlapping stype), instead it should be as in new ebay app (as if scrolling the wallpaper in homescreen with more than one page). Is it possible to add this effect to material-design-navigation-view? How do I do it?
You can use Sliding Menu Library for your requirement. Here is the link to that library
Sliding Menu Library
And if you are using Android Studio then see this link to add it in your project
Importing in Android Studio
There is no default way to really do this. However, this thread of StackOverflow will help you: push activity on the right when open drawer
Another GitHub library that may suit your need is: Material Drawer. You can download the demo on Google Play Store (same name). A similar approach is the Persistent Header Drawer
I have made my navigation drawer and it is working all fine , it is according to new design rules. but now I have a problem and after a couple of search I have found no note over it so far. So I end up with asking question here.
What I have done so far is some thing like
the picture shows you the demo , How ever I have made some thing like this its just the demo to give you people hint about what is header in the navigation drawer and where my menu items list lies
You can clearly see that there is a header in the navigation drawer and the menu item list beneath it .
Problem 1
now do to some reasons I have deleted the header , but my menu Items goes upwards to the top starting point. I know I can give margin up , but this is not the good way
Is there any good way I can just centralized them vertically ? I am wondering How to do it , Please Help me .
and Problem 2 is , I want to minimize the distance and margin between the menu items and menu icons in navigation drawer How to do this. I have not seen any of the discussion over it.
Please help me in solving both problems.
On screenshot you attached to your question, the navigation drawer doesn't look fine and according to the new desing rules :-/
Just have a look at the official guide: https://www.google.com/design/spec/patterns/navigation-drawer.html
Luckly for you nowdays we are provided by Google with Android Design Support Library that helps us with creating Navigation View (that replaces Navigation Drawer)
Here are links for you:
official documentation, always a good read: https://developer.android.com/reference/android/support/design/widget/NavigationView.html
nicely written blog post about Navigation View: http://antonioleiva.com/navigation-view/
and last but not least, sample app using new Android Design Library: https://github.com/antoniolg/MaterializeYourApp
I know it's not the answer you were looking for, like "just change true to false in the line number 10" but stay assured that using official Navigation View is a way to go in modern Android world.
You can use the new NavigationView from the Android Design Support Library in making your navigation drawer. NavigationView make s creating material design-compliant navigation drawer.
You can read about it at http://android-developers.blogspot.com/2015/05/android-design-support-library.html
Read these three articles
Take a look at this code
Use the design support library
I would like to implement a custom navigation drawer (such as the one shown here) and I have been trying all kinds of navigation menu libraries for Android and iOS but haven't come up with a good option. Is there any library that could achieve this kind of navigation or does anyone have any idea how this could be done as a custom component?
You can try SlidingMenu. Its one of the most widely used alternatives for navigation drawer. Its gives you a whole host of options which are listed on their homepage.
First
Second
Second I used before and it is nice as for me, but first one looks more promising.
Happy coding :)
For example, please view this image from the Android Developers site.
Basically, I want to replicate this navigation drawer, currently I have it all except the sub items (Option 1, Option 2, in the example). There is no documentation on how to get this on the developers site. This is what I have currently:
MainActivity.java: http://pastebin.com/iNXW00ex
SeparatedListAdapter.java: http://pastebin.com/fESuvEVi
MainActivity.xml: http://pastebin.com/gg4JANwh
Drawer Item/Header.xml: http://pastebin.com/WzvPXQYm
That's all I think is needed. I'm aware that typically a expandable list view is used for the child items, though I'm unsure how to combine that with the current separated list adapter so I can still get titles.
Thanks, David.
There are a lot of third party libs for sliding menus.
Why not use one of them instead of trying to recreate Android's?
For example:
https://github.com/jfeinstein10/SlidingMenu
Have you checked out the Navigation Drawer tutorial in the Android docs?
http://developer.android.com/training/implementing-navigation/nav-drawer.html
Uses classes in the support library to make implementing the nav drawer pretty straightforward.
I don't think these examples use viewpager, but visually they look a little like viewpager.
See Evernote's settings:
http://1.androidauthority.com/wp-content/uploads/howto/evernote-screenshots-120524.jpg
And Pocket Casts' handheld control pane:
http://www.shiftyjelly.com/android/pocketcasts
Basically, a panel is swiped in from left, but the left edge of the previous panel is still visible.
So my question is, is this UI pattern featured in an example you have seen, or did these two make it out of whole cloth and now I have to, too?
Edit for posterity:
As of Google I/O 2013, this is now built into Android. They call it the Navigation Drawer: http://developer.android.com/training/implementing-navigation/nav-drawer.html
https://github.com/jfeinstein10/SlidingMenu
This library might help you out. I think this is what you're trying to achieve.
EDIT
I've updated the link to another SlidingMenu library but as of 2015/09/16, I wouldn't use the library referenced here anyway. Google has provided the DrawerLayout in the v4 support library to achieve this. Inside the drawer, for a more standard structured navigation, the design support library has also provided the NavigationView that can be placed inside the DrawerLayout and use standard menu resource to inflate the items contained within. This SO can help out with the details of the implementation.