您的位置:首页 > 其它

ionic splash screen  之后出现的白屏解决办法

2016-02-29 19:33 573 查看
ionic项目中,在splashscreen消失后会出现零点几秒的白屏,再出现app页面,通过Google以及各种尝试,下面方法解决:

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);
}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: