Blinking screen on image transition between activities
Solution 1:
On the exiting activity, call
getWindow().setExitTransition(null);
On the entering activity, call
getWindow().setEnterTransition(null);
It will prevent the fade out of the exiting activity and the fade in of the entering activity, which removes the apparent blinking effect.
Solution 2:
I solved this issue by changing background color of my default theme, hope this is still can help to someone save the time.
<item name="android:windowBackground">@color/black</item>
<item name="android:colorBackground">@color/black</item>
Solution 3:
The "white blinking" you are seeing is the result of the two activities alpha-animating in and out during the transition: when activity A
starts activity B
, activity A
fades out and activity B
fades in.
If you want to prevent the status bar and/or navigation bar from fading during the transition (and thus reducing the "blinking" effect a bit), you can look at this post.
Solution 4:
Make some method in helper like
public static Transition makeEnterTransition() {
Transition fade = new Fade();
fade.excludeTarget(android.R.id.navigationBarBackground, true);
fade.excludeTarget(android.R.id.statusBarBackground, true);
return fade;
}
Execute it in the activity that you are starting like this
getWindow().setEnterTransition(TransitionUtils.makeEnterTransition());
Source https://github.com/alexjlockwood/custom-lollipop-transitions/