Android Shared element transition - prevent shared element from being drawn
Asked Answered
Q

1

11

I'm working in a custom Transition to animate only the visible part of the Shared View in case it is partially visible.

In my case this happens because the Shared View is inside a ConstraitLayout, and the ConstraitLayout inside a ScrollView.

I mentioned this problem in another question: Shared element transition - animate only the visible part of the shared view

This is the defaul transition choose by the system:

enter image description here

And this is the one where I'm working:

enter image description here

The animation itself works well ... But the problem is the system draws the full shared view, before the animation starts... and there is an ugly blink.

How can I prevent that?

I have already on my style:

<item name="android:windowSharedElementsUseOverlay">false</item>

Quadrireme answered 4/2, 2018 at 16:51 Comment(1)
Could you provide a GitHub link to your project? Adding only the relevant files to fix this problem.Aliped
E
1

In your target Activity, add an ActionBar like the one in the source Activity, so that it naturally covers the same of your shared element. You might need to pass extras between Activities to configure the target ActionBar.

Eckard answered 12/2, 2018 at 1:21 Comment(1)
I do not understand why I have to add the same toolbar in the target activity, besides that it is just an example, what if the View that covers the SharedView is not the Toolbar and is in another position on the screenPlacid

© 2022 - 2024 — McMap. All rights reserved.