关于Android 应用启动后有一小会儿白屏问题

1、在style中自定义主题AppTheme.Splash

   <style name="AppTheme.Splash">
        <item name="android:windowBackground">@null</item>
        <item name="android:windowDisablePreview">true</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

windowBackground和windowDisablePreview是关键。

2、在AndroidManifest.xml文件中新增自己启动页面的theme

        <activity android:name=".ui.SplashActivity"
            android:theme="@style/AppTheme.Splash">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

3、在启动页面中的onCreate添加 

setTheme(R.style.AppTheme_Splash)

猜你喜欢

转载自blog.csdn.net/fl2502923/article/details/109328429
今日推荐