Android 解决启动页白屏或者黑屏的问题

欢迎页启动的线程由于请求和处理的数据量过大而,导致欢迎页在出现之前界面上会有一个短暂的白色闪屏停留,当然白色闪屏的停留是因为 application 的主题样式android:theme=@style/AppTheme 使用了 Theme.Light 题导致的,Light 样式的 windowBackground、colorBackground、colorForeground 等属性的值均为 light 也就是白色偏亮,所以才会出现白色闪屏。

下面是我的 APP 出现白色闪屏时样式引用的代码:

 <style name="startactivitytheme" parent="android:Theme.Light.NoTitleBar">
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowBackground">@drawable/trip_bg_logo_iamge</item>
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

  

 <!-- 启动页面 -->
        <activity
            android:name="com.xxx.xxx.xxx.activity.StartActivity"
            android:screenOrientation="portrait"
            android:theme="@style/startactivitytheme" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

  

原文地址:https://www.cnblogs.com/tony-yang-flutter/p/4193858.html