ITeye博客

phonegap-splashscreen

fanfq · 2012-11-02 14:20 · html54mobile · 移动开发 · Markdown

其实就是自定义一个启动页面,不顾完全可以不用这么做,MainActivity就可以充当启动页面来做,这个是官方的例子就顺便学习一下。同时这里也有延迟加载的例子。 index.html [code="html"] Splashscreen Example

Example

[/code] MainActivity.java [code="java"] package com.fanfq.phonegap.splashscreen; import org.apache.cordova.DroidGap; import android.os.Bundle; public class MainActivity extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // The first line 'super.setIntegerProperty' sets the image to be // displayed as the splashscreen. If you have named your image anything // other than splash.png you will have to modify this line. The second // line is the normal 'super.loadUrl' line but it has a second parameter // which is the timeout value for the splash screen. In this example the // splash screen will display for 10 seconds. If you want to dismiss the // splash screen once you get the "deviceready" event you should call // the navigator.splashscreen.hide() method. super.setIntegerProperty("splashscreen", R.drawable.splash); super.loadUrl("file:///android_asset/www/index.html", 10000); } } [/code]

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。