Android Navigation Drawer should be centralized vertically - android

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

Related

Sleek navigation drawer

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 :)

MenuDrawer with fragments not showing underneath ActionBar

I am using SimonVT's MenuDrawer library (https://github.com/SimonVT/android-menudrawer) and have followed his Fragments sample in his code. Everything is working great, however in the fragments sample the menu appears on the entire left side of the screen (top to bottom) which goes thru/over the ActionBar. I am looking to have the Menu Drawer appear below the ActionBar at all times so the ActionBar stays in place. I have tried both properties OVERLAY and BEHIND but both take over the entire left side of the screen.
This is NOT what I want - http://i102.photobucket.com/albums/m91/saucergumshoe/MenuDrawerFragmentExampleMenuOverActionBar_zpsda4664f1.jpg
This is what I want, you can see the menu is below the ActionBar - http://i102.photobucket.com/albums/m91/saucergumshoe/MenuDrawerLeftOverlayExampleMenuUnderActionBar_zps7a20baa9.jpg
I am fairly new to Android so maybe I am making a silly mistake?
Here are the main settings on the Drawer:
mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY, getDrawerPosition(), getDragMode());
mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
mMenuDrawer.setSlideDrawable(R.drawable.ic_drawer);
mMenuDrawer.setDrawerIndicatorEnabled(true);
Set the drag mode to MENU_DRAG_CONTENT
mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY, getDrawerPosition(), MenuDrawer.MENU_DRAG_CONTENT);
What I can suggest you, is to use the official NavigationDrawer from Google as explained at https://developer.android.com/design/patterns/navigation-drawer.html.
There's also a link to a tutorial with sample code: https://developer.android.com/training/implementing-navigation/nav-drawer.html.
You can follow it to understand how to create a correct drawer and you can also download the source code as well.
This is the official component provided by Google and it behaves exactly as you asked in your question and like all the Google apps (and many others).

What is the new slide-menu that apps like 4sq and G+ are using recently?

well, I am working with an slide-menu library a couple of months ago (https://github.com/jfeinstein10/SlidingMenu), but I'm having trouble working with it since I'm using a Map fragment and I have this error: How to remove black cover on top of sliding menu?
I have worked with some workarounds about how to "solve" this issue, but anyways, in some phones doesn't look that fine. So I was wondering about changing slide-menu library, and then I saw 4sq and G+ changing theirs. About a month ago, for example, G+ used to look like this: How did Google manage to do this? Slide ActionBar in Android application
And 4sq like this: ActionBar and sliding out menu in android, but now they changed (to the same slide menu library I guess) and look like this:
You can see here that 4sq app changed the menu most likely because they suffered same issue with the map fragment.
As you can see, now slide menu goes OVER the view, and it has 3 horizontal tiny bars that hints the user to tap on it in order to discover a menu. Those bars shrink and expand when expanding/colapsing the menu.
I remember once I saw someone here in stackoverflow referencing this library, It's just I can't remember the name of the library neither the question I read it from.
This is the new DrawerLayout class in the support library. There's an entire page devoted to setting it up here.
To get more informations about practices, design or navigation, check this page.

Sliding Drawer left to right and i want use all activities

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

How to replicate the example navigation drawer from Android Docs?

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.

Categories

Resources