启动屏幕Phonegap 3.3后消除白色闪烁 [英] Remove White Flicker after splashscreen phonegap 3.3

查看:100
本文介绍了启动屏幕Phonegap 3.3后消除白色闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个应用程序,添加启动画面插件,当设备就绪且没有WHITE FLICKER出现时,启动画面应消失?这发生在Adobe版本以及android平台上的cli版本上!

How is it possible to create an app, add the splashscreen plugin, the splashscreen should disappear when the device is ready and no WHITE FLICKER to appear?? This happends on Adobe build and also on cli build on android plaform!

这些是我一遍又一遍地反复使用以找出问题的简单步骤:

These are the simple steps I used over and over again for about a week to figure this thing out:

  • 我创建了一个应用:phonegap创建应用
  • 我添加了插件:phonegap本地插件添加了org.apache.cordova.splashscreen
  • 我将其从www文件夹添加到config.xml文件中:
<feature name="SplashScreen">
    <param name="android-package" value="org.apache.cordova.splashscreen" />
<!--     <param name="onload" value="true" /> -->
</feature>

现在插件已设置. 为了确保在加载对象后启动画面消失,我添加了:

Now the plugin is set. To make sure that the splashscreen disappears after the devide is loadeed I added:

navigator.splashscreen.hide(); 

在index.js中onDeviceReady函数下

in index.js under function onDeviceReady

通过此步骤,它可以正常运行.初始屏幕显示ok,它消失ok但出现白色闪烁.为什么这在发生呢?启动画面是否在所有内容加载之前就隐藏了?为什么? 我注意到,当我将启动画面设置为例如3秒钟的值时,白色闪烁消失,但是我希望它随着设备就绪而消失,因为我还有另一种效果,那就是从设备就绪开始,如果我第二次进入在应用程序中,加载速度更快,并且启动画面始终保持在不必要的位置,并且效果发生在启动画面下方.

With this steps it works ok. The splashscreen shows ok, it disappears ok but a white flash appears. Why on earth is this happening? Is the splashscreen hiding before everything loads or why? I noticed that when I set the splashscreen a value for example 3 seconds, the white flash disappears but I want it to disappear as fast as the device is ready because I have another effect wich starts with the device ready and if I enter the second time in the app, this loads faster and the splashscreen just stays on unnecesarry and the effect happends underneath the splashscreen.

那么如何最终解决这个问题?

So how to finally solve this thing?

我也尝试过

<preference name="AutoHideSplashScreen" value="false" />

我尝试将主体背景设置为黑色,因为我所说的效果是一个黑色的div,它会在应用程序开始时淡出.

I tried setting the body background to black because the effect I was talking about was a black div that fades out at the start of the application.

我还尝试将Webview设为黑色

And I also tried making webview black

<preference name="backgroundColor" value="0x000000" />

一切都没有运气.

我该如何解决?我认为,最简单的方法是将webview设置为黑色,但我的首选项命令不起作用.

How can I solve this? I think that the easyest way out of here is to set the webview to black but my preference command is not working.

推荐答案

我在我的config.xml中添加了<preference name="SplashScreenDelay" value="10000" />以确保启动屏幕保持打开状态,然后在应用程序的主页后将navigator.splashscreen.hide()隐藏它创建(而不是在"deviceready"之后立即创建).如果我在设备就绪后立即将其放好,则会出现白色闪烁,因为我有条件地更改了页面.

I added <preference name="SplashScreenDelay" value="10000" /> to my config.xml to make sure splash screen stays on, then navigator.splashscreen.hide() to hide it after my app's home page is created (rather than immediately after 'deviceready'). If I put it right after deviceready, I get a white flash because I conditionally change pages.

您甚至可以在navigator.splashscreen.hide()上执行setTimeout,达到几百毫秒(或任何延迟时间).

You could even do a setTimeout on the navigator.splashscreen.hide(), to a couple hundred ms (or whatever the delay time is).

这篇关于启动屏幕Phonegap 3.3后消除白色闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆