Android 如何创建类似Netflix的折叠工具栏
如何像netflix那样创建折叠工具栏。recyclerview可以在状态栏后面绘制,而工具栏不能 我试着创建一个,但不知怎么的,它无法工作。将android:fitsystemwindows=“false”设置为协调器布局也会影响工具栏 fragment_main.xmlAndroid 如何创建类似Netflix的折叠工具栏,android,android-layout,android-collapsingtoolbarlayout,Android,Android Layout,Android Collapsingtoolbarlayout,如何像netflix那样创建折叠工具栏。recyclerview可以在状态栏后面绘制,而工具栏不能 我试着创建一个,但不知怎么的,它无法工作。将android:fitsystemwindows=“false”设置为协调器布局也会影响工具栏 fragment_main.xml <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/
<androidx.coordinatorlayout.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"
android:fitsSystemWindows="false"
android:background="@color/netflix_black">
<include
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/content"
layout="@layout/layout_content"/>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolBarLayoutView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp"
android:background="@android:color/transparent"
>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<ImageView
android:layout_width="56dp"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:src ="@drawable/logo_netflix"
/>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/toolBarLayoutView"
android:layout_width="match_parent"
android:background="@android:color/transparent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/parentRv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
layout\u content.xml
<androidx.coordinatorlayout.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"
android:fitsSystemWindows="false"
android:background="@color/netflix_black">
<include
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/content"
layout="@layout/layout_content"/>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolBarLayoutView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp"
android:background="@android:color/transparent"
>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<ImageView
android:layout_width="56dp"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:src ="@drawable/logo_netflix"
/>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/toolBarLayoutView"
android:layout_width="match_parent"
android:background="@android:color/transparent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/parentRv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
兄弟,这个问题你解决了吗?