<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
app:elevation="0dp"
android:elevation="0dp"
app:liftOnScroll="true"
app:liftOnScrollColor="@android:color/transparent"
android:layout_width="match_parent"
android:layout_height="150dp">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:background="#ffffff"
app:contentScrim="#ffffff"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
分2种,可以去尝试:
AppBarLayout 的 liftOnScrollColor
CollapsingToolbarLayout 的 contentScrim。