我正在尝试使用导航体系结构组件实现以下片段过渡。当使用片段管理器启动片段时,此动画效果完美。但是,使用导航体系结构组件,当片段B进入时,片段A消失。我使用了对片段A不执行任何操作的假动画,但仍然没有帮助。有什么想法可以解决吗?
这是我在nav_graph.xml中的代码
department_name
slide_in_from_bottom.xml
<fragment
android:id="@+id/fragmentA"
android:name="xxxx.FragmentA"
android:label="FragmentA"
tools:layout="@layout/fragment_a" >
<action
android:id="@+id/action_fragmentA_to_fragmentB"
app:destination="@id/fragmentB"
app:enterAnim="@anim/slide_in_from_bottom"
app:exitAnim="@anim/fake_anim" />
</fragment>
fake_anim.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:shareInterpolator="true">
<translate android:duration="250" android:fromYDelta="100%" android:toYDelta="0%" />
</set>
答案 0 :(得分:1)
看起来这是jetpack库中的错误。将不得不等待,直到他们解决此问题:https://issuetracker.google.com/issues/118843009