主要問題:app點開時一般會黑屏或者白屏幾秒鐘,然後再出現歡迎頁的圖片,主要是因爲activity theme的問題。
解決方法:就是自定義一個theme就可以了,然後把你的歡迎頁的theme設成你自定義的就可以了,然後歡迎頁如果沒有廣告或者其他需求,那就不用寫歡迎頁xml文件了。
自定義theme:
<style name="splash" parent="AppTheme">
<item name="android:windowFullscreen">true</item>
<item name="android:background">@drawable/start</item>
<item name="android:windowNoTitle">true</item>
</style>
把這個theme設置到你的歡迎頁activity裏:
android:theme="@style/splash"
最後記得把你歡迎頁面xml裏展示圖片的imageview刪掉或者直接不用setContentView問題。
最後你會發現問題解決了,希望給大家帶來幫助。