美文网首页
CoordinatorLayout+AppBarLayout(顶

CoordinatorLayout+AppBarLayout(顶

作者: 苏未_ | 来源:发表于2019-10-08 18:06 被阅读0次
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:orientation="vertical">

        <android.support.design.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:background="@color/white"
            android:clipChildren="false"
            android:clipToPadding="false">

            <android.support.design.widget.AppBarLayout
                android:id="@+id/app_bar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:clipChildren="false"
                android:clipToPadding="false"
                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                app:elevation="0dp">

                <android.support.design.widget.CollapsingToolbarLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:clipChildren="false"
                    android:clipToPadding="false"
                    app:layout_behavior="@string/appbar_fling_behavior"
                    app:layout_scrollFlags="scroll|enterAlways|snap">

                    <android.support.v7.widget.Toolbar
                        android:id="@+id/toolbar"
                        android:layout_width="match_parent"
                        android:layout_height="44dp"
                        android:alpha="0"
                        android:background="@android:color/white"
                        android:tag="toolbar"
                        app:layout_collapseMode="pin"
                        app:popupTheme="@style/Widget.AppCompat.Toolbar" />

                </android.support.design.widget.CollapsingToolbarLayout>
            </android.support.design.widget.AppBarLayout>

        </android.support.design.widget.CoordinatorLayout>

</RelativeLayout>

主要是 app:layout_scrollFlags="scroll|enterAlways|snap" 这里

相关文章

网友评论

      本文标题:CoordinatorLayout+AppBarLayout(顶

      本文链接:https://www.haomeiwen.com/subject/clyiyctx.html