How To fix white screen on app Start up?

2019-01-03 01:28发布

I have an android app which displays a white screen for 2 seconds on startup. My other apps don't do this, but this one does. I have also implemented a splashscreen with the hope that it would fix this. Should I increase my splash screen sleep time? Thanks.

13条回答
一夜七次
2楼-- · 2019-01-03 02:24

It can be fixed by setting the theme in your manifest as

<activity
        android:name=".MySplashActivityName"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" >
 <intent-filter>
     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

and after that if you are getting
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
then you may need to extend Activity instead of AppCompatActivity in your MySplashActivity.

Hope it helps!

查看更多
登录 后发表回答