三部解决白屏问题:
1.在styles.xml里定义一个style,设置windowBackground属性:
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen">
<item name="android:windowBackground">@drawable/icon_launch3</item>
<item name="android:windowFullscreen">true</item>
</style>
2.在AndroidManifest.xml文件中的启动页配置theme属性为上面定义的style:
<activity
android:name=".activity.LaunchActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/LaunchTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<!--支持外部打开此应用-->
<data android:scheme="cesi"/>
</intent-filter>
</activity>
3.LaunchActivity一定要继承Activity不然会报错
结语:
本文章根据:https://www.jianshu.com/p/436b91175826 总结,想了解的更详细请查看