而在应用程序之间切换黑屏 [英] Black Screen while Switching between applications
问题描述
我有两个应用程序,当我从一个应用程序切换到另一个显示了一阵黑色屏幕,然后第二个应用程序启动时,我们可以阻止这种情况的发生?
I have two apps and when i switch from one app to another a black screen is displayed for a while and then the 2nd application starts, can we stop this from happening?
推荐答案
其中一个最简单的方法是从你的活动的的onCreate 和在onStart移动所有昂贵的(耗时)处理方法的 onResume 方式。这样,你的新推出的活动将是其推出后的可见光右但随后会采取一些额外的,以使其可用于用户交互。此外,我建议你将所有繁重的的AsyncTask 流畅的UI体验。
One of the simplest way is to move all the expensive (time-consuming) processing from your activity's onCreate and onStart method to onResume method. By this, your newly launched activity will be visible right after its launched but then will take a little extra to make it available for user to interact. Further, I would suggest you to move all the heavy lifting in AsyncTask for smoother UI experience.
您也可以尝试这个主题为您的活动
You can also try this theme for your Activity
<resources>
<!-- Base application theme is the default theme. -->
<style name="Theme" parent="android:style/Theme" />
<style name="Theme.MyAppTheme" parent="Theme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@drawable/my_app_background</item>
</style>
</resources>
这篇关于而在应用程序之间切换黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!