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?
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With