在活动的图像过渡闪屏 [英] Blinking screen on image transition between activities
问题描述
我实现了利用棒棒糖新的共享元素两项活动之间的图像转换。它的工作,但我得到一个奇怪的白色过渡期间闪烁在整个屏幕上,我无法找到如何摆脱它。下面是一个例子:
I implemented an image transition between two activities using the new shared elements from lollipop. It's working but I get a weird white blinking on the entire screen during the transition and I can't find how to get rid of it. Here is an example:
下面是如何在第二个活动启动
Here is how the second activity is launched
public static void launch(
@NonNull Activity activity, @NonNull View transitionView, Game game) {
ActivityOptionsCompat options =
ActivityOptionsCompat.makeSceneTransitionAnimation(
activity, transitionView, game.gameFullId);
Intent intent = new Intent(activity, ListImportationLoginActivity.class);
intent.putExtra(INTENT_EXTRA_GAME, retailer);
ActivityCompat.startActivity(activity, intent, options.toBundle());
}
然后在的onCreate:
Then in onCreate:
ViewCompat.setTransitionName(mLogoView, mGame.gameFullId);
和主题文件:
<resources>
<style name="Theme.MyApp.NoActionBar" parent="Theme.MyApp.NoActionBar.Base">
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>
</resources>
感谢您的帮助
Thanks for your help
推荐答案
白色闪烁你看到的是进出过渡期间,两项活动的α-动画的结果是:如果活动 A
启动活动 B
,活性 A
淡出和活动乙
淡入
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.
如果你想prevent从过渡时期衰落(并因此减少了闪烁的效果了一下),你可以看看的this帖子。
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.
这篇关于在活动的图像过渡闪屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!