我正在尝试使用导航架构组件实现下面的片段转换 . 使用片段管理器启动片段时,此动画非常有效 . 但是对于导航架构组件,当片段B进入时,片段A消失 . 我使用了假动画,它对片段A没有任何作用,但它仍然无济于事 . 我有什么想法可以解决它吗?
这是我在nav_graph.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>
slide_in_from_bottom.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>
fake_anim.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="1.0"
android:toAlpha="1.0"
android:duration="250" />
</set>
1 回答
看起来这是jetpack库中的一个错误 . 将不得不等到他们解决这个问题:https://issuetracker.google.com/issues/118843009