Android Shared View Transition Combined With Fade Transition
Solution 1:
I found a solution to this "problem". The problem is that this is intended behaviour. You can disable the overlap by calling
getWindow().setSharedElementsUseOverlay(false);`
But that more often than not creates artifacts. I ended up doing it either way, and removed the background on my Activity, with a transparent theme:
<style name="Theme.Transparent" parent="@style/AppTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
Since my goal was to fade in the text in the CollapsingToolbarLayout, I could not achieve this since the ImageView is a child of the layout. What I ended up doing was adding another ImageView with the same image as the one being animated between activities, and fading it in along with the CollapsingToolbarLayout after the Activity shared element transition was done. Since the shared element image already was in place the new ImageView didn't make any difference in the UI. The solution is of course not optimal, but the only one for my problem - considering how the APIs behave. When exiting the Activity I simply hide the replacement ImageView, and the user sees the shared element image translating into place in the parent Activity.
Post a Comment for "Android Shared View Transition Combined With Fade Transition"