How to use shared element snapshot views during an Activity transition?
P

0

11

I am confused about the List<View> sharedElementSnapshots argument that is passed to the SharedElementCallback's onSharedElementStart() and onSharedElementEnd() methods. Presumably these snapshot views are meant to be used as temporary placeholders during a shared element transition. For example, let's say activity A displayed a thumbnail image and activity B displays a high-resolution version of that same image that will take a couple seconds to load and be displayed. Instead of having to wait for the high-resolution image to finish loading, the snapshot view could be temporarily used in its place instead.

The part I'm confused me about is how the snapshot views are meant to be used in the first place. Are they supposed to be added to the activity's view hierarchy? Or maybe they are meant to be added to the window decor view's ViewOverlay instead? Either way, I don't see how it is possible to switch the transitioning shared element views at this point... onMapSharedElements() is called before onSharedElementStart() and onSharedElementEnd(), meaning the final mapping of transition names to shared element Views will have already been established.

Any hints would be greatly appreciated.

Perfunctory answered 21/3, 2015 at 21:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.