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

本文探讨了APP启动时出现白色闪屏的原因,并详细解释了这是由于使用了Light主题样式,导致界面背景呈现白色。文章还提供了具体的样式配置代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

欢迎页启动的线程由于请求和处理的数据量过大而,导致欢迎页在出现之前界面上会有一个短暂的白色闪屏停留,当然白色闪屏的停留是因为 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>

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值