Implementing Navigation Drawer in android using different ways - android

I am working on an application, in which I need to implement navigation drawer. We have two different ways of implement navigation drawer in android as shown in attached screen shots :
In first way the sliding list is over main content. In second type, sliding list becomes visible and make main content to slide left to right with Navigation Drawer list.
I goggled a lot about this and only got solution of first type. I want to implement Navigation drawer like second type in attached screenshot. So please tell me what changes I need to make.
Thanks.

For the first case google's official Navigation Drawer is there.
And for the second case there's a third party library on github.
here's the link: https://github.com/jfeinstein10/SlidingMenu
Also I feel you've to use ActionBarSherlock (again a third party library) in order to implement the second case.
Moreover the google's drawer method is the recommended one as it supports a stable action bar, from where you can choose items even when the drawer is open. Also the design + app flow is slick and faster in this case as compared to the third party lib.

Related

NavigationDrawer on right managed by fragment or not?

I use this library:
https://github.com/mikepenz/MaterialDrawer
I would like to have a right NavigationDrawer with a ListView (or a lot of items) inside and I get items from DB inside the Fragment and when user click on items on the NavigationDrawer I get data from another DB and show it on Fragment.
and I have a questions:
is possible to create a right Drawer inside a Fragment? or is better to create a new right Drawer in MainActivity and change the navigation item inside the Fragment?
Just use brand new Navigation View from recenlty released Android Design Support Library by Google.
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
To have Navigation View on the right, just set android:layout_gravity to end.
As from design point of view, you should always use left sided Navigation Drawer, it is possible to make it right sided, but its recommended to leave it at the left side.
Another thing is that you do not need to use 3rd party navigation drawer libraries.Since there is a Design library by google, which supports the material design navigation view.
Here is a link for the library:
https://developer.android.com/tools/support-library/features.html
And here is another useful link:
https://guides.codepath.com/android/Design-Support-Library
Here is the link for the Navigation Drawer: https://guides.codepath.com/android/Fragment-Navigation-Drawer
As for your question the appropriate way is to create the drawer always in the main activity onCreate() method.

Navigation Drawer + Sliding Tabs inside fragment Android

I'm trying to get a NavigationDrawer working with sliding tabs inside a fragment (just like google play music or the google i/o app). In all my reasearch I found that you can't use Action bar tabs + Navigation Drawer together because the Navigation drawer will look like in the back of the tabs (I notice that). Can anyone help me telling me how to get that done without use an external library such ActionBarSherlock or TabHost (according to the documentation is recommended the use of actionbar)?
Yes, you're right. It won't be possible using ActionBar tabs as the navigation drawer won't overlap them. I recently implemented a library called ViewPagerAddons which has a custom view called SlidingTabLayoutColors imitating the behavior seen in Google Play/Music.
But as you said you don't want to use any libraries, you can still have a look at the source code. Here's the link with instructions: https://bitbucket.org/enthusiast94/viewpageraddons

Android navigation drawer - two levels

I am looking to replicate the iOS app my company makes and on tablet in landscape they have a second nav drawer slide out from the first for the second level of categories.
e.g. in the first level they have clothes, shoes, accessories, then if you click clothes a second one appears scrolling to the right from the far right of the first nav bar, that then shows things like shirts, t-shirt, jeans, jumpers etc.
Is this possible in android? And if so, is it the accepted way of doing things?
Thanks
on tablet in landscape they have a second nav drawer slide out from the first for the second level of categories.
That's not a nav drawer, then, at least as defined by Google.
Is this possible in android?
Sure, just not using DrawerLayout. Execute a FragmentTransaction to slide in the second list adjacent to the first list, neither of which are in a DrawerLayout.
And if so, is it the accepted way of doing things?
For a two-tier structure, I suspect that you will see other patterns used:
ExpandableListView
tabs for the first tier, and simpler master-detail for the second tier
action bar list navigation for the first tier, and simpler master-detail for the second tier
etc.
I can't even rule out DrawerLayout as being the implementation of the first tier (with traditional master-detail for the second tier), though the stuff in that list does not strike me as fitting the usage pattern for a navigation drawer.
Sure, It is possbile. But it is not a practise using in android.
If you want to implement this design, the best way is to use two fragments instead of navigation drawer and use FragmentTrasation to provide the animations.

What is the difference between the SlidingMenu library and the Android Navigation Drawer?

The SlidingMenu library is an excellent third party library and I've already used it for a long time. Now I know Android provides a new navigation pattern using Navigation Drawer. It looks like the sliding menu. So is there anyone who already uses these two both? What is the difference and what are the pros and cons? Thanks a lot.
SlidingMenu library is a third party api which uses a RelativeLayout inside. The main advantage is customization according to your requirement. Buy your layouts have to be based on a viewgroup, unfortunatly this negates the <merge> optimisations.
Navigation Drawer is available in the Support Library of android it uses DrawerLayout inside. The main advantage is improved performance.
They also have different visual effects. SlidingMenu looks like horizontal scroll view. Sliding it in will push the main content out.
Pros :
It comes with cool entrance / exit animations for the menu content.
Depending on what Activity you use it on, it can be placed below the Action Bar or next to it (pushing the Action Bar too)
You can explicitly set the touch mode via a setter: margin or full screen. In full screen mode touching anywhere on the screen will open the menu. In margin, only when you slide from the edge of screen will the menu open.
Cons :
You can only control the shadow of the side menu
Navigation Drawer / Drawer Layout looks like an additional top level view in a frame layout. Sliding it in will mask the main content.
Pros :
If you use v4 support lib then it's already there.
You can control both the side menu shadow and obscure the main
content via setScrimColor e.g when the drawer is opened, a fade-in
alpha layer will appear above the main content. This is good to visually separate the content and the menu especially when both have a same color.
Cons:
It can only be placed below ActionBar
There is no setter for touch mode and by default you can only do margin touch mode. Doing a full screen touch mode (like Youtube) involves a lot of work
I think the best advantage is that It is official Google code, I mean it just works and works excellent.
The main disadvantage is that it is very basic to use, I mean... you cannot put two navigation drawer in the same activity or fragment, you can only use one in left and that's it.
You already said it yourself. Sliding menu is third party. Navigation drawer is official. Both have the same purpose, but third party libraries might implementing it slightly differently, depending on which one you use.

create app with menu at the bottom (like many iphone apps), how to organize activity / fragments

I want to create a app with a menu at the bottom of the screen. This menu should be visible any time the app is started.
Im working with fragments, so the menu is one fragment.
So I have only one Activity as controller which loads different fragments above the menu fragment.
Because I want to create clean code, i dont know how to solve the problem that the Activity class is too big.
In other words, i want to create different controller within the same activity. How to do that?
Is there another approach to solve this issue?
You should be using the split action bar This allows you to put the Actions and overflow menu on the bottom of the screen. I believe you can use Action Bar Sherlock for backwards compatibility to older versions of Android. See their site for detail.
Another possibility is to look into using fragments with the ViewPager . Here is a library that works with compatability as well ViewPageIndicator . Here is a blog post , like I indicated in my comment I got this working with the tabs showing at the bottom and the pages above.

Categories

Resources