默認情況下啓動APP時會出現0.5s左右的白屏然後纔會顯示自己設定啓動頁的圖片,這樣會照成很不好的用戶體驗;
解決方案:在style中定義一 個theme將啓動頁的背景圖片設置成windowBackground視覺上避免白屏現象
step1:在style中定義them
<style name="SplashTheme" parent="AppTheme"> <!-- 將splash圖片設置在這,這樣這張圖片將取代白屏 --> <item name="android:windowBackground">@drawable/splash</item> <item name="android:windowFullscreen">true</item> </style>step2:在清單配置文件中給啓動頁activity制定theme
<activity android:name=".activity.SplashActivity" android:theme="@style/SplashTheme" />
然後重新運行即可。