0

我有一个共享元素过渡动画的奇怪问题(可能是过渡库中的错误)。目标Android version5.0

这是我的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"                                     xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/root_layout">

        <RelativeLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <!-- The main content view -->
            <FrameLayout
                android:id="@+id/content_main"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                >
            </FrameLayout>

            <!-- The second content view -->
            <FrameLayout
                android:id="@+id/content_second"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                >
            </FrameLayout>

        </RelativeLayout>
</RelativeLayout>

我有 2 个片段(FragmentAFragmentB)。FragmentAimageViewA并且FragmentBimageViewA更大的尺寸。共享元素转换定义正确,FragmentB打开时imageViewA动画正确。

它仅在FragmentA添加到content_frame容器(根容器)时才起作用。如果我要添加FragmentAcontent_main容器中 - 动画根本不起作用。

  • 如果我向content_second容器添加一些视图 - 动画不起作用。
  • 如果我将content_second容器保持为空 - 动画不起作用。
  • 即使我删除content_second容器 - 动画也不起作用。

两个片段将被添加到同一个容器中(使用FragmentTransaction.replace)。

4

0 回答 0