Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 557
XWang Avatar asked May 29 '13 10:05

XWang


People also ask

What is the use of navigation drawer in Android?

The navigation drawer is a UI panel that shows your app's main navigation menu. The drawer appears when the user touches the drawer icon in the app bar or when the user swipes a finger from the left edge of the screen.

How does navigation drawer work?

The navigation drawer slides in from the left and contains the navigation destinations for the app. The user can view the navigation drawer when the user swipes a finger from the left edge of the activity. They can also find it from the home activity by tapping the app icon in the action bar.


3 Answers

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.

like image 61
Arun C Avatar answered Oct 04 '22 16:10

Arun C


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
like image 38
inmyth Avatar answered Oct 04 '22 16:10

inmyth


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.

like image 21
Nicolas Jafelle Avatar answered Oct 04 '22 16:10

Nicolas Jafelle