Material Design (10)--coordinatorlayout and app Bar

Source: Internet
Author: User

Adding Toobar directly to the appbarlayout gives you enteralwaycollapsed and exituntilcollapsed access to these scrolling tabs, Rather than the ability to control the details of how different elements respond to collapsing. To get the effect of the latter, you can use Collapsingtoolbarlayout:

1<Android.support.design.widget.AppBarLayout2 Android:layout_height= ' 192DP '3 Android:layout_width= ' match_parent '>4<Android.support.design.widget.CollapsingToolbarLayout5 Android:layout_width= ' match_parent '6 Android:layout_height= ' match_parent '7 App:layout_scrollflags= ' scroll|exituntilcollapsed '>8<Android.support.v7.widget.Toolbar9 Android:layout_height= '? attr/actionbarsize 'Ten Android:layout_width= ' match_parent 'App:layout_collapsemode= ' pin '/> A</Android.support.design.widget.CollapsingToolbarLayout> -</Android.support.design.widget.AppBarLayout>

The above settings use Collapsingtoolbarlayout's app:layout_collapsemode= "pin" attribute to ensure that the toolbar itself can still be booked at the top of the screen when the view is collapse. And maybe more, when you use Collapsingtoolbarlayout and toolbar together, when the layout is fully visible, the title will automatically appear larger and then transition to its default size when the toolbar collapse. Note that in these cases, you should call Collapsingtoolbarlayot's Settittle () instead of the Settitle () of the toolbar itself.

View collapsing toolbar effect Click (Note FQ when not open)

In addition to the ability to subscribe to a view, you can use App:layout_collapsemode= "parallax" (optional, app:layout_collapseparallaxmultiplier= "0.7" To set the scrolling parallax multiplication factor) to achieve scrolling parallax effects (such as sibling ImageView inside Collapsingtoolbarlayout). This use example will App:layout_collapseparallaxmultiplier and Collapsingtoolbarlayout's app:contentscrim= "? Attr/colorPrimary" Paired with a pair, the result is a full-bleed gauze effect added to the view collapse.

Material Design (10)--coordinatorlayout and app Bar

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.