在启动类的清单文件中添加
android:theme="@style/AppTheme.Splash"
<activity android:name=".activity.MainActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="standard" android:screenOrientation="portrait" android:theme="@style/AppTheme.Splash" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
随后在styles.xml文件中添加,设置背景图片,用来替换掉启动时的白屏
<style name="AppTheme.Splash" parent="AppTheme"> <item name="windowNoTitle">true</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowBackground">@drawable/huanying</item>//用来替换的图片 <item name="android:windowFullscreen">true</item> </style>