phoneGap开机启动动画



phoneGap启动时会有一段时间加载view,此时界面会白屏,用户体验不好,可以设置开机启动图片解决,

在onCreate()中添加以下,

super.setIntegerProperty("splashscreen", R.drawable.splash);

然后只需要将不同分辨率的图片放在 res/里面的几个drawable文件,图片名称为splash.后缀名

启动开机图片后,还需要设置多久后再把它关闭,需写在index.html文件里

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

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

     }

super.loadUrl(Config.getStartUrl()),等同于:super.loadUrl("file:///android_asset/www/index.html") 

你可能感兴趣的:(phoneGap开机启动动画)