【发布时间】:2020-10-27 13:27:55
【问题描述】:
我希望在从列表中删除项目之后发生过渡,但是当我删除项目时,过渡发生得更早,并且它涵盖了其他项目,如下面的 GIF 所示。 我的第二个问题是,当我使用 layoutTransition 时,创建片段时它会随着动画展开,如何在一开始就避免这种情况。 我的布局是这样的:
<androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:fillViewport="true" >
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
在片段中:(Kotlin):
scroll_view.layoutTransition.enableTransitionType(LayoutTransition.CHANGING)
scroll_view.layoutTransition.setStartDelay(LayoutTransition.CHANGING,300)
constraintlayout.layoutTransition.enableTransitionType(LayoutTransition.CHANGING)
constraintlayout.layoutTransition.setStartDelay(LayoutTransition.CHANGING,300)
但没有任何变化,总是相同的行为
【问题讨论】:
标签: android kotlin android-recyclerview layouttransition