ionic安卓啟動時短暫的黑屏或白屏問題
阿新 • • 發佈:2018-12-31
- 首先在config.xml 中配置:
<preference name="SplashScreen" value="splash" />
- 其次在路徑為
platforms/android/res/values/
(備註:紅色的Android是小寫的)下新建styles.xml,編輯如下: -
<resources> <style name="Theme.AppStartLoadTranslucent" parent="android:Theme"> <item name="android:windowBackground">@drawable/screen</item> <item name="android:windowNoTitle">true</item> </style> </resources>
-
在
platforms/android/AndroidManifest.xml
中的android:name為”MainActivity”的activity(備註: 一般都是第一個activity),修改它的theme值,如:android:theme="@style/Theme.AppStartLoadTranslucent"
-
通過上面的方法,我們再次run或build的時候, 應用啟動,直接顯示的是啟動頁splash,而不再是短暫的黑屏或白屏之再到啟動頁了。