源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Android程序启动时出现黑屏问题的解决方法

  • 时间:2021-06-11 12:41 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Android程序启动时出现黑屏问题的解决方法
本文实例讲述了Android程序启动时出现黑屏问题的解决方法。分享给大家供大家参考,具体如下: [b]关于黑屏:[/b] 默认的情况下,程序启动时,会有一个黑屏的时期,原因是,首个activity会加载一些数据,比如初始化列表数据、向服务器发送请求获取数据等等。 [b]去除方法:[/b] 1、在style里面添加一个style:
<style name="ContentOverlay"parent="@android:style/Theme.Light">
<itemname="android:windowNoTitle">true</item>
<itemname="android:windowIsTranslucent">true</item>
<itemname="android:windowContentOverlay">@null</item>
</style>

2、将主题设置到启动activity的主题里面
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:name=".TWeiboApplication"
android:debuggable="true"
android:theme="@style/ContentOverlay">
<activity
android:name=".MainSplashActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@style/ContentOverlay">
<intent-filter> 
<actionandroid:name="android.intent.action.MAIN"/> 
<categoryandroid:name="android.intent.category.LAUNCHER"/> 
</intent-filter>
</activity>

[b]android 界面切换黑屏处理:[/b] 从A切换到B的过程中出现黑屏,可以在Manifest文件中改变B的theme,在theme里添加:
<item name="android:windowIsTranslucent">true</item>

这样从A到B的过程中,因为B是透明的,所以背景就是A。这样的用户体验比较好。 更多关于Android相关内容感兴趣的读者可查看本站专题:《[url=http://www.1sucai.cn/Special/367.htm]Android编程之activity操作技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/375.htm]Android视图View技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/848.htm]Android操作SQLite数据库技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/845.htm]Android操作json格式数据技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/402.htm]Android数据库操作技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/325.htm]Android文件操作技巧汇总[/url]》、《[url=http://www.1sucai.cn/Special/224.htm]Android编程开发之SD卡操作方法汇总[/url]》、《[url=http://www.1sucai.cn/Special/410.htm]Android开发入门与进阶教程[/url]》、《[url=http://www.1sucai.cn/Special/423.htm]Android资源操作技巧汇总[/url]》及《[url=http://www.1sucai.cn/Special/124.htm]Android控件用法总结[/url]》 希望本文所述对大家Android程序设计有所帮助。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部