CoordinatorLayout的使用

来源:互联网 发布:csgo fps优化 编辑:程序博客网 时间:2024/05/29 23:45


写在前面:


<?xml version="1.0" encoding="utf-8"?><!-- 第一部分:CoordinatorLayout --><android.support.design.widget.CoordinatorLayout        xmlns:android="http://schemas.android.com/apk/res/android"        xmlns:app="http://schemas.android.com/apk/res-auto"        android:layout_width="match_parent"        android:layout_height="match_parent" xmlns:tools="http://schemas.android.com/tools">    <!-- 第二部分:缩放控件-->    <android.support.design.widget.AppBarLayout            android:id="@+id/collapsing_tool_bar_test_abl"            android:layout_width="match_parent"            android:fitsSystemWindows="true"            android:layout_height="192dp">        <android.support.design.widget.CollapsingToolbarLayout                android:id="@+id/collapsing_tool_bar_test_ctl"                android:layout_width="match_parent"                android:layout_height="match_parent"                app:layout_scrollFlags="scroll|exitUntilCollapsed"                android:fitsSystemWindows="true"                app:contentScrim="?attr/colorPrimary"                app:expandedTitleMarginStart="48dp"                app:expandedTitleMarginEnd="64dp">            <ImageView                    android:id="@+id/back_drop"                    android:layout_width="match_parent"                    android:layout_height="match_parent"                    android:scaleType="centerCrop"                    android:src="@mipmap/ic_launcher"                    android:fitsSystemWindows="true"/>            <android.support.v7.widget.Toolbar                    android:id="@+id/collapsing_tool_bar_test_tb"                    android:layout_width="match_parent"                    android:layout_height="?attr/actionBarSize"                    app:layout_scrollFlags="scroll|exitUntilCollapsed"                    app:layout_collapseMode="parallax"                    app:layout_collapseParallaxMultiplier="0.7"/>        </android.support.design.widget.CollapsingToolbarLayout>    </android.support.design.widget.AppBarLayout>    <!-- 第三部分:Your Scroll View-->    <android.support.v4.widget.NestedScrollView            android:layout_width="match_parent"            android:layout_height="match_parent"            app:layout_behavior="@string/appbar_scrolling_view_behavior">        <LinearLayout                android:layout_width="match_parent"                android:layout_height="match_parent"                android:orientation="vertical"                android:paddingTop="24dp">            <TextView android:layout_width="match_parent" android:layout_height="200dp"                      android:text="Hello 1"            />            <TextView android:layout_width="match_parent" android:layout_height="200dp"                      android:text="Hello 2"            />            <TextView android:layout_width="match_parent" android:layout_height="200dp"                      android:text="Hello 3"            />            <TextView android:layout_width="match_parent" android:layout_height="200dp"                      android:text="Hello 4"            />            <TextView android:layout_width="match_parent" android:layout_height="200dp"                      android:text="Hello 5"            />        </LinearLayout>    </android.support.v4.widget.NestedScrollView></android.support.design.widget.CoordinatorLayout>



0 0
原创粉丝点击