More advanced toolbar Use the----appbarlayout

Source: Internet
Author: User

Appbarlayout is actually a linearlayout, but the Design support library does a lot of scrolling events for it,

Nest toolbar into appbarlayout and assign a layout behavior to the control that displays the subject content of the page

  <Android.support.design.widget.AppBarLayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content">            <Android.support.v7.widget.ToolbarAndroid:id= "@+id/toolbar"Android:layout_width= "Match_parent"Android:layout_height= "? Attr/actionbarsize"Android:background= "? Attr/colorprimary"Android:popuptheme= "@style/themeoverlay.appcompat.light"Android:theme= "@style/themeoverlay.appcompat.dark.actionbar"

Scroll indicates that when the content is scrolled toobar will scroll up and hide,
Enteralways indicates that when the content country scrolls, the toolbar will scroll and display in the countryside.
Snap means that when the content is not completely hidden or displayed, the hidden or displayed app:layout_scrollflags are automatically selected based on the distance currently scrolled
= "Scroll|enteralways|snap" /><!--Toobar Add this property in Appbarlayout toolbar will be hidden with the content of the theme, the next row appears - </Android.support.design.widget.AppBarLayout>

Specify layout behavior

App:layout_behavior= "@string/appbar_scrolling_view_behavior"

Don't forget to add design support dependencies

More advanced toolbar Use the----appbarlayout

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.