Android-navigation Drawer

Source: Internet
Author: User

http://www.jianshu.com/p/c8cbeb7ea43a

Use Navigation Drawer and Navigation View to achieve left and right side slide

You don't even have to write anything in the activity.

Navigationdrawer Introduction

Navigationdrawer is a side-by-side navigation bar design style introduced by Google in Material. may be very abstract, we directly to see NetEase cloud Music slide navigation bar effect

Google has introduced a new control--drawerlayout to support this navigation effect. But before Drawerlayout was born, the need to realize the sliding navigation effect, we will choose to choose some mature third-party open source libraries (such as the most famous Slidingmenu) to complete the development.

After comparing the implementation of Drawerlayout and Slidingmenu , based on the following points, I think it is entirely possible to use drawerlayout in development to replace the previous Slidingmenu:

    1. From the animation effect, you will find that the two are only a few differences in the effect of the movement, other places are not too big differences
    2. In the interactive effect, I think the two are similar, even if you put NetEase cloud music effect on the hand Q , will not affect the user's interaction
    3. Drawerlayout is easier to use than Slidingmenu , with less code (see below)
    4. drawerlayout is backwards compatible, so there is no low-version compatibility issue
    5. Google Pro son, no reason not to support AH!!!!!!

Here, if you have not yet introduced the impulse of drawerlayout Development, please continue to listen to me for your good.

Under normal circumstances, the DrawerlayoutThere are only two sub-layouts under the layout, one Content Layoutand a Slide Menu Layout, the key to these two layouts is android:layout_gravityThe settings for the property. If you want to set one of the sub-layouts to be the left-hand slide menu, you only need to set android:layout_gravity= "Start"(or left, or end or right), and the layout without settings naturally becomes Content Layout

to recognize Navigationview

Navigationview and drawerlayout are the best combination of official recommendations in Google's launch of the navigationdrawer design. Before using Navigationview, because it is in the Compatibility pack of Material Design, you need to first introduce it in Build.gradle

    ‘com.android.support:design:23.1.1‘

Actionbardrawertoggle

Implement return picture and animation effects

http://blog.csdn.net/chencehnggq/article/details/21492417

http://blog.csdn.net/zxm317122667/article/details/50989346

Actionbardrawertoggle is the listener for the Drawerlayout event.

Actionbardrawertoggle has 3 methods that can be replicated to implement Drawerlayout open, close, and sliding event monitoring:

Ondraweropened Drawerlayout is called when sliding out

ondrawerclosed Drawerlayout closed when called

Ondrawerslide Drawerlayout is called when sliding

Android-navigation Drawer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.