导航架构组件导致片段B进入时片段A消失

时间:2018-12-11 17:11:51

标签: android android-fragments android-architecture-components android-jetpack android-architecture-navigation

我正在尝试使用导航体系结构组件实现以下片段过渡。当使用片段管理器启动片段时,此动画效果完美。但是,使用导航体系结构组件,当片段B进入时,片段A消失。我使用了对片段A不执行任何操作的假动画,但仍然没有帮助。有什么想法可以解决吗?

enter image description here

这是我在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>

1 个答案:

答案 0 :(得分:1)

看起来这是jetpack库中的错误。将不得不等待,直到他们解决此问题:https://issuetracker.google.com/issues/118843009

相关问题