Glitch when animating nested views in a shared element Activity transition?

可紊 提交于 2019-11-30 09:12:23
George Mount

Yes, you can transition a group and its contents separately. But you just found a bug that will be fixed in L MR1.

It appears that this is not well supported in L. I recommend that you make the shared elements siblings in the second Activity:

<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <View
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/dark_gray"
        android:transitionName="outer_box"/>

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

        <View
            android:id="@+id/inner_box"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_marginLeft="50dp"
            android:layout_marginTop="50dp"
            android:background="@color/red"
            android:transitionName="inner_box" />
    </RelativeLayout>
</FrameLayout>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!