吸顶CoordinatorLayout+AppBarLayout+CollapsingToolbarLayout+Banner+Toolbar+TabLayout+RecyclerView

微生俊健
2023-12-01
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/coll"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:contentScrim="@color/design_default_color_primary_dark"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="250dp"
                android:scaleType="centerCrop"
                android:src="@mipmap/ic_launcher"
                app:layout_scrollFlags="scroll" />

            <androidx.appcompat.widget.Toolbar
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_margin="20dp"/>

            <TextView
                android:id="@+id/tv_search_v2"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_margin="20dp"
                android:background="@color/white"
                app:layout_collapseMode="pin"
                android:gravity="center"
                android:hint="搜索" />

        </com.google.android.material.appbar.CollapsingToolbarLayout>
        <TextView
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:background="@color/white"
            android:gravity="center"
            android:text="tablayout" />
    </com.google.android.material.appbar.AppBarLayout>
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rv_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
 类似资料: