I\'ve been messing around with the new APIs in Android 5.0 and have been trying to figure out whether or not it is possible to animate both a ViewGroup
and one
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>