折叠Tab

2019-09-26  本文已影响0人  小慧sir
<?xml version="1.0" encoding="utf-8"?>
<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=".MainActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        app:theme="@style/ToolbarTheme">
        <!--app:layout_scrollFlags="scroll|enterAlways"-->
        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsingToolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:navigationIcon="@mipmap/timg">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fitsSystemWindows="true"
                android:orientation="vertical"
                android:scaleType="centerInside"
                app:layout_collapseMode="parallax">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="200dp"
                    android:background="@mipmap/timg1" />
            </LinearLayout>

            <android.support.v7.widget.Toolbar
                android:id="@+id/bar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="#00ffffff"
                android:gravity="center_vertical"
                app:layout_collapseMode="pin"
                app:navigationIcon="@mipmap/back"
                app:popupTheme="@style/AppTheme.PopupOverlay"
                app:theme="@style/ToolbarTheme"
                app:titleTextColor="#ffffff" />


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

        <android.support.design.widget.TabLayout
            android:id="@+id/tl"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#0ff"
            app:tabIndicatorColor="#666666"
            app:tabSelectedTextColor="#e21717"
            app:tabTextColor="#4D4D4D" />
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/vp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>
上一篇 下一篇

猜你喜欢

热点阅读