Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Shared element transition - prevent shared element from being drawn

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>

like image 372
Oscar Méndez Avatar asked Feb 04 '18 16:02

Oscar Méndez


1 Answers

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.

like image 197
Leo supports Monica Cellio Avatar answered Sep 18 '22 17:09

Leo supports Monica Cellio