美文网首页studioAndroid知识Android开发
Android-避免App启动黑白屏闪现的2种方式

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

作者: 影视会员万事通 | 来源:发表于2016-10-03 14:19 被阅读268次

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. 我的:GitHub
  3. 我的:博客
  4. 我的:CSDN
  5. Email:1619153872@qq.com
  6. 微信:


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

相关文章

网友评论

    本文标题:Android-避免App启动黑白屏闪现的2种方式

    本文链接:https://www.haomeiwen.com/subject/wpcjyttx.html