国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

完美解決Android App啟動頁有白屏閃過的問題

瀏覽:106日期:2022-09-22 17:18:01

應用啟動的時候有短暫的白屏,如圖:

完美解決Android App啟動頁有白屏閃過的問題

可以通過設置theme的方式來解決

<style name='AppTheme' parent='Theme.AppCompat.Light.NoActionBar'> <!-- Customize your theme here. --> <item name='colorPrimary'>@color/colorPrimary</item> <item name='colorPrimaryDark'>@color/colorPrimaryDark</item> <item name='colorAccent'>@color/colorAccent</item> </style> <style name='AppTheme.Transparent'> <item name='android:windowIsTranslucent'>true</item> <item name='windowNoTitle'>true</item> </style>

在AndroidManifest中使用 AppTheme.Transparent

<activity android:name='.MainActivity' android:theme='@style/AppTheme.Transparent' > <intent-filter><action android:name='android.intent.action.MAIN' /><action android:name='android.intent.action.VIEW'/><category android:name='android.intent.category.LAUNCHER' /> </intent-filter> </activity>

然后重新運行程序安裝。

完美解決Android App啟動頁有白屏閃過的問題

補充知識:解決Android啟動頁白屏及圖片拉伸的問題

【Android小知識】

為了解決Android冷啟動延遲、白屏等問題,往往會將啟動圖片設置到styles.xml文件中去,但是直接在style文件中引用圖片的話很大可能會造成圖片拉伸和變形,所以建議將圖片配置到xml中去,最后在style文件中引入xml就可以了,如下代碼所示:

style.xml

<style name='SplashActivityThemes' parent='Theme.AppCompat.NoActionBar'> <item name='android:windowBackground'>@drawable/bg_splash</item> <item name='android:windowFullscreen'>true</item> </style>

bg_splash.xml

<?xml version='1.0' encoding='utf-8'?><layer-list xmlns:android='http://schemas.android.com/apk/res/android' > <item> <shape> <solid android:color='#FFFFFF'/> </shape> </item> <item android:bottom='50dp'> <bitmap android:gravity='bottom|center_horizontal' android:src='http://www.intensediesel.com/bcjs/@mipmap/icon_welcome'/> </item></layer-list>

以上這篇完美解決Android App啟動頁有白屏閃過的問題就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: Android
相關文章:
主站蜘蛛池模板: 融水| 固镇县| 固镇县| 洪江市| 萨迦县| 霍林郭勒市| 蓬莱市| 吉木萨尔县| 怀柔区| 色达县| 沂水县| 古田县| 昔阳县| 平陆县| 垣曲县| 如皋市| 海晏县| 庆安县| 林州市| 清原| 通许县| 五华县| 图们市| 确山县| 杭州市| 上高县| 和龙市| 孟州市| 女性| 鲁甸县| 旬邑县| 年辖:市辖区| 涪陵区| 乐陵市| 新竹市| 崇义县| 湾仔区| 资阳市| 夏河县| 马鞍山市| 鄂托克前旗|