我的应用程序加载时如何避免Android中的黑屏?

Dam*_*mir 8 android android-widget android-windowmanager

我的应用程序加载时如何避免Android中的黑屏?我已经从onCreate删除了所有东西到AsyncTask,但我仍然在开头有黑屏.我的默认(第一个)活动是Main,如果有一个参数,我会暂时加载Personal活动,而不显示Main,否则我会显示Main活动.谁能建议我解决方案?我尝试了http://blog.iangclifton.com/2011/01/01/android-splash-screens-done-right/,但它没有帮助.

Apr*_*ith 19

我不确定.

但是,Manifest在你的内心尝试这个activity

android:theme="@android:style/Theme.Translucent" 
Run Code Online (Sandbox Code Playgroud)

要么

android:theme="@android:style/Theme.Light"
Run Code Online (Sandbox Code Playgroud)

我已经看到了关于闪屏的一个很好的解决方案......希望它有用

/sf/answers/605805301/


Ash*_*ini 14

在样式标记的android style.xml文件中添加以下行.

 <item name="android:windowDisablePreview">true</item>
Run Code Online (Sandbox Code Playgroud)

完整代码:

 <style name="AppBaseTheme" parent="android:Theme.Light.NoTitleBar">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
    <item name="android:windowDisablePreview">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)