Enter transition on a fragment with a shared element targets the shared element Enter transition on a fragment with a shared element targets the shared element android android

Enter transition on a fragment with a shared element targets the shared element


The enter transition should not apply the the shared element views. The most likely scenario is that your shared element is within another view with a background, making that view affected by the enter transition. That's a situation like this:

<FrameLayout    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:background="#FFF"    >    <ImageView android:src="@drawable/pretty_picture"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:transitionName="picture"        android:padding="20dp"/></FrameLayout>

Here, the ImageView is the shared element.

If that happens, you'll want to add a magic transition: ChangeTransform. If it detects that the parent changes, it will pull out the shared element from the parent and transition it separately.