Android 片段共享元素转换z顺序因AppBarLayout而中断
我有以下布局文件:Android 片段共享元素转换z顺序因AppBarLayout而中断,android,android-appbarlayout,shared-element-transition,Android,Android Appbarlayout,Shared Element Transition,我有以下布局文件: fragment_a.xml <androidx.coordinatorlayout.widget.CoordinatorLayout android:id="@+id/coordinator" android:layout_width="match_parent" android:layout_height="match_parent"> <com.google.
fragment_a.xml
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="@dimen/header_height"
android:scaleType="centerCrop"
android:transitionName="@string/transition_image" />
<View
android:id="@+id/scrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transitionName="@string/transition_scrim" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/contentList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:transitionName="@string/transition_list" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:transitionName="@string/transition_image" />
<View
android:id="@+id/scrim"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/white"
android:alpha="0.8"
android:transitionName="@string/transition_scrim"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/header_height" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/contentList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:transitionName="@string/transition_list"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
我正在两个片段之间进行共享元素转换
如果工具栏没有开始折叠,并且contentList
在scrim
和image
的顶部设置动画,则转换工作正常。如果应用程序条的垂直偏移量与扩展值稍有不同,则scrim
和图像将在内容列表
顶部设置动画。因此,在设置动画时z顺序会发生变化。这里有什么问题?应用程序栏在折叠时是否会更改其子项的z值