您好,我正在将 phonegap 与 Jquery mobile 结合使用。我试图立即获取主页,同时向用户显示启动画面。
我在 PhoneGap for Android 中使用这个
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl("file:///android_asset/www/index.html", 2000);
虽然这会加载启动画面,但也会延迟 index.html 的加载。是否可以立即开始获取它?另外,如果不使用 phonegap,是否有人使用 JQM 而不是 phonegap 来完成此操作?
更新:在第一页加载速度较慢(执行 json 请求)时使用它后,启动画面似乎显示了更长的时间,所以这似乎是默认行为
最佳答案
如给定here ,一旦加载了所有 Assets 和 DOM 元素,就可以关闭启动画面。
是这样的: java :
super.setIntegerProperty("splashscreen",R.drawable.splashscreen);
super.loadUrl("file:///android_asset/www/index.html", 2000);
在您的 HTML、javascript 部分:
function onDeviceReady()
{
cordova.exec(null, null, "SplashScreen", "hide", []);
window.MacAddress = new MacAddress();
window.MacAddress.getMacAddress(function(result){
database._mac_address = result.mac;
}, function(){
database._mac_address = '01:02:03:04:05:06';
});
}
关于android - 在 android 上使用 phonegap 在启动画面上加载第一页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9328037/