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

后端 未结 4 1434
暗喜
暗喜 2021-02-04 04:05

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 Draw

相关标签:
4条回答
  • 2021-02-04 04:14

    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
    0 讨论(0)
  • 2021-02-04 04:22

    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.

    0 讨论(0)
  • 2021-02-04 04:26

    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.

    0 讨论(0)
  • 2021-02-04 04:30

    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.

    0 讨论(0)
提交回复
热议问题