"Frame" coordinatorlayout Coordinator layout

Source: Internet
Author: User

<?xml version= "1.0" encoding= "Utf-8"?><!--Coordinator layout, the layout is divided into two parts, the first part is a AppBar the second part is a scrolling control, there are two types of scroll controls available:1.NestedScrollView, 2. Recyclerview--><android.support.design.widget.CoordinatorLayout xmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:app= "Http://schemas.android.com/apk/res-auto"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Tools:context= "Org.mobiletrain.a8_2coordinatorlayout." Mainactivity "> <android.support.design.widget.AppBarLayout android:layout_width= "Match_parent"Android:layout_height= "200DP" > <!--App:layout_scrollflags= "Scroll"represents the folding behavior of collapsingtoolbarlayout, a total of 5 kinds of values:1. Scroll indicates that collapsingtoolbarlayout can scroll2the. Enteralways means that the head is displayed as soon as the scroll controls below scroll down3the. Enteralwayscollapsed indicates that the head is displayed when the scroll control below the peak4. exituntilcollapsed means that when the collapsingtoolbarlayout is folded to the minimum height (the height of the toolbar), the collapse is stopped5. Snap means that if you stop collapsing during the collapse process, Collapsingtoolbarlayout will dock nearby App:contentscrim= "@color/colorprimary"represents the Color toolbar displayed when Collapsingtoolbarlayout is folded to the minimum height app:layout_collapsemode= "Parallax"represents the collapsed mode of a collapsingtoolbarlayout neutron control, with two values:1. Parallax indicates that the control's folding speed is not synchronized with the folding speed of the Collapsingtoolbarlayout2the. Pin indicates that the control stays in the head app:layout_collapseparallaxmultiplier when the collapse is complete= "1" indicates visual multiplier (visual difference), value 0~1a 0 means that the control is collapsed above, not collapsed below 1 to indicate that the control is collapsed below, not collapsed0~1 between the upper and lower folds, 0. 5 indicates that the upper and lower folding rate is the same, greater than 0.5 means the lower folding rate is greater than the app:title above the folding rate collapsingtoolbarlayout= "Coordinator Layout"Property overrides the title on toolbar, it is recommended that you do not use toolbar's title app:collapsedtitlegravity when using Collapsingtoolbarlayout= "Right"represents the position of the title after folding app:expandedtitlegravity= "Bottom|right"indicates the position of the title after expansion-<android.support.design.widget.CollapsingToolbarLayout android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"app:collapsedtitlegravity= "Left"App:contentscrim= "@color/colorprimary"app:expandedtitlegravity= "Bottom|right"App:layout_scrollflags= "Scroll|exituntilcollapsed"App:title= "Coordinator Layout" > <ImageView android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:scaletype= "Centercrop"android:src= "@drawable/p1"App:layout_collapsemode= "Parallax"App:layout_collapseparallaxmultiplier= "0.5"/> <Android.support.v7.widget.Toolbar Android:id= "@+id/toolbar"Android:layout_width= "Match_parent"Android:layout_height= "? Attr/actionbarsize"App:layout_collapsemode= "Pin" ></android.support.v7.widget.Toolbar> </android.support.design.widget.collapsingtoolbarlayout > </android.support.design.widget.AppBarLayout> <!--App:layout_behavior= "@string/appbar_scrolling_view_behavior"This string represents the address of the class that coordinates the scrolling control and appbar work together-<Android.support.v4.widget.NestedScrollView android:layout_width= "Match_parent"Android:layout_height= "Match_parent"App:layout_behavior= "@string/appbar_scrolling_view_behavior" > <TextView android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:text= "@string/book_content"/> </android.support.v4.widget.nestedscrollview></ Android.support.design.widget.coordinatorlayout>
 Public class extends appcompatactivity {    @Override    protectedvoid  onCreate (Bundle Savedinstancestate) {        super. OnCreate (savedinstancestate);        Setcontentview (R.layout.activity_main);         = (Toolbar) Findviewbyid (R.id.toolbar);        Setsupportactionbar (toolbar);    }}

"Frame" coordinatorlayout Coordinator layout

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.