ionic splash screen 之后出现的白屏解决办法
2016-02-29 19:33
573 查看
ionic项目中,在splashscreen消失后会出现零点几秒的白屏,再出现app页面,通过Google以及各种尝试,下面方法解决:
1. 安装Cordova splash screen插件
2. 修改ionic项目的config.xml 文件,
即不让闪屏自动隐藏,而在代码中手动隐藏splash screen
3. 在app.js中添加隐藏闪屏代码
1. 安装Cordova splash screen插件
$ cd myapp $ ionic plugin add org.apache.cordova.splashscreen
2. 修改ionic项目的config.xml 文件,
<preference name="AutoHideSplashScreen" value="false"/>
<preference name="ShowSplashScreenSpinner" value="false"/> <preference name="SplashMaintainAspectRatio" value="true"/> <preference name="SplashShowOnlyFirstTime" value="false"/> <preference name="SplashScreenDelay" value="10000"/> <preference name="FadeSplashScreen" value="false"/>
即不让闪屏自动隐藏,而在代码中手动隐藏splash screen
3. 在app.js中添加隐藏闪屏代码
$ionicPlatform.ready(function () { if (window.cordova && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.disableScroll(true); //延迟splash screnn 隐藏时间,不然会有短暂的白屏出现 setTimeout(function () { navigator.splashscreen.hide(); }, 1000); } });
相关文章推荐
- 常用字符串长度计算函数
- Retrofit2.0的Converter使用
- 自我介绍
- 浅谈过载保护
- PHP连接MySQL数据库过程
- 牛人的ACM经验 (转)
- 【转】没什么能够阻挡,你对自由的向往
- Java如何对Map进行排序详解
- MVC,MVP 和 MVVM 的图示
- MVP 一种实现方式
- 【BZOJ 3732】 Network Kruskal重构树+倍增LCA
- 饭卡------HDOJ杭电2546(还是01背包!!!!!!)
- 【转】小屁孩, 懂个啥
- 个人简介
- [原] KVM 环境下MySQL性能对比
- HDU 5056 Boring count
- js与html和css的关系
- BroadcastReceiver(广播接收者)
- Nginx模块 ngx_http_limit_conn_module 限制连接数
- ACM 群赛