8

During a shared element Activity transition, shared elements are drawn in the window decor view's ViewOverlay by default. If necessary, the developer can disable this default behavior by calling the Window#setSharedElementsUseOverlay(false) method. The Fragment class, however, does not seem to declare a similar method for Fragment transitions.

For Fragment transitions, are shared elements also drawn in a view overlay on top of the fragment's view hierarchy by default? If so, is there a way to disable the default behavior as there is in the Activity transitions API?

Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250

1 Answers1

11

No, shared elements in Fragment Transitions are not drawn in the overlay by default. However, ChangeTransform can pull a shared element into the overlay when it detects that its transform and its parent transform differ. You can disable this in the ChangeTransform transition by setting

android:reparentWithOverlay="false"
George Mount
  • 20,708
  • 2
  • 73
  • 61