2014-09-11 53 views
0

我的phonegap應用程序在向您顯示「index.html」之前會顯示一個閃屏...但無論我做什麼,無論我設置了多少超時,它都會忽略它,並顯示不到半秒的時間。 。我喜歡的事實,應用程序加載速度快,但顯示如此短暫的時間飛濺擊敗整個目的...Phonegap splashscreen自動消失

我試圖把這樣的延遲super.loadUrl("file:///android_asset/www/index.html", 5000);沒有運氣......沒有.. 。只是忽略它...

然後我嘗試這個https://github.com/apache/cordova-plugin-splashscreen/blob/master/doc/index.md

設置偏好:

<preference name="SplashScreen" value="splash" /> 
<preference name="SplashScreenDelay" value="5000" /> 

再次沒有。它讓我瘋狂......任何想法? 我也可以發佈更多的代碼....

回答

0

THI添加到您的​​3210

<preference name="AutoHideSplashScreen" value="false" /> 
//So splashscreen won't be hidden automatically. 

添加到您的index.html

document.addEventListener("deviceready", onDeviceReady, false); 

function onDeviceReady() { 
    setTimeout(function() { 
     navigator.splashscreen.hide(); 
    }, 2000); 
} 

這會在onDeviceReady事件後2秒隱藏啓動畫面。 您可以將2000毫秒更改爲任何您想要的值。

+0

即使沒有splashscreen.hide()飛濺仍然消失在不到一秒...我不知道爲什麼 – Pero44 2014-09-11 10:25:39

+0

好吧,我只是注意到,我有2 config.xml文件...一個是在資產文件夾和一個在res/xml文件夾中...爲什麼需要編輯 – Pero44 2014-09-11 10:43:10

+0

您需要'res/xml'文件夾中的一個 – benka 2014-09-11 10:47:43

0

你只需在config.xml中更改'SplashScreenDelay'的值。

<preference name="SplashScreenDelay" value="3000" /> <!-- this will add 3000 ms delay --> 

如果它不工作,然後嘗試刪除並再次使用添加平臺:

cordova platform rm platform-name 
cordova platform add platform-name