Android provides traps for toolbar implementation of the Scrub menu

Source: Internet
Author: User

The code is as follows:

<LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "vertical">    <!--Tool Bar -    <includeLayout= "@layout/toolbar_main"></include>    <Android.support.v4.widget.DrawerLayoutAndroid:id= "@+id/dl_alllayout"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:fitssystemwindows= "true">        <!--The content *************** must be placed below the sliding menu ************** -        <includeLayout= "@layout/content_main"/>        <!--Sliding Menu -        <includeLayout= "@layout/layout_left_menu"></include>    </Android.support.v4.widget.DrawerLayout></LinearLayout>

As we all know, the Android system adds the toolbar toolbar and drawer effect to the SUPPORT-V7 package after 3.0:

Import Android.support.v7.app.ActionBarDrawerToggle; import Android.support.v7.widget.Toolbar;

Then add the left slide menu and the main content in the Drawerlayout must pay attention to the priority add, activity in the main content, after adding a scrub menu layout.

If the order is reversed, you cannot respond to any events such as "click", "Scrub" in the drawer window, and when you slide the drawer menu out of the activity, you cannot swipe it with your finger to hide it (you can hide it via the toolbar button).

Because Drawerlayout will finally parse the scrub menu.

Please be careful with the majority of Android Basin friends!!!

Android provides traps for toolbar implementation of the Scrub menu

Related Article

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.