Shared element transition leaves a strange white background between first activity and second transparent activity
Asked Answered
A

1

12

Recently I faced up with a weird problem. I have two activities. The first one contains a grid with a thumbnails. A kind of a gallery. And the second one contains a view pager with fragments and behaves like an image viewer where you can slide between images. I use a shared element transition to start the second activity. Just like Google Photo app. On the second activity I can swipe to top or bottom to dismiss the activity with a fade away transition of the background. I made my second activity fully transparent:

<item name="android:windowBackground">@color/palette_transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>

But the problem is when I swipe an image to top/bottom and the second activity's background fades I can see a white background but not the first activity. If I start the second activity without shared element transition everything is fine.

I made a research and found out that this white layer probably overlays the first activity. It is not a part of the second activity as I can see in Stetho view hierarchy.

Probably my explanation is not very good neither my English language so here a couple of videos too clarify my problem.

Video Without transition and Video With transition

Aundrea answered 16/9, 2016 at 11:6 Comment(5)
Did you solve this? im just having same issuePrudish
@Prudish Yes. The problem was with windowEnterTransition and windowExitTransition attributes in our theme. We just removed them and white blink is gone.Aundrea
I'm stuck with the same problem. Will you please help me by sharing your style, please. And I haven't added any entry or exit transitions as well.Mikamikado
@GuruKarthiR please check my answer.Aundrea
Ya, I have tried that too. But it doesn't work out well as expected. @ArtyomShalaevMikamikado
A
1

This should help:

<item name="android:windowEnterTransition">@android:transition/no_transition</item>
<item name="android:windowExitTransition">@android:transition/no_transition</item>
Aundrea answered 17/1, 2019 at 12:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.