您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页Android-避免App启动黑白屏闪现的2种方式

Android-避免App启动黑白屏闪现的2种方式

来源:二三娱乐

App每次启动程序都会闪一下黑屏或白屏(取决于使用的全局样式),因为启动Activity的时候,需要执行完onCreate和onResume才会显示界面。也就是说需要处理一些数据后,才会显示,就算onCreate方法里什么不做,仍然会闪一下黑屏,因为初始化解析界面时需要一定时间。

1、自定义Theme

<style name="Theme.AppStartLoad" parent="android:Theme">    
    <item name="android:windowBackground">@drawable/ic_splash</item>    
    <item name="android:windowNoTitle">true</item>    
</style> 

2、设置透明Theme

<style name="Theme.AppStartLoadTranslucent" parent="android:Theme">    
    <item name="android:windowIsTranslucent">true</item>   
    <item name="android:windowNoTitle">true</item>    
</style> 

<h3>The End:</h3>

  1. 我的:
  2. 我的:
  3. 我的:
  4. 我的:
  5. Email:
  6. 微信:


    扫一扫上面的二维码,加我微信

Copyright © 2019- yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务