美文网首页
Android 启动页全屏

Android 启动页全屏

作者: _发强 | 来源:发表于2023-05-15 12:56 被阅读0次

解决 Android 开屏页显示之前出现系统默认页面,黑屏或者白屏

说人话,就是在加载启动页的时候,会多显示一个系统默认的页面,不属于启动页的内容。

处理方式就是为 启动页单独加一个 theme:

添加 theme

    <style name="Theme.Splash" parent="Theme.CoreKtx">
        <item name="android:windowIsTranslucent">true</item>
    </style>
image.png

配置 Activity

        <activity
            android:name=".feature.SplashActivity"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.Splash"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

相关文章

网友评论

      本文标题:Android 启动页全屏

      本文链接:https://www.haomeiwen.com/subject/qobmsdtx.html