PhoneGap启动画面

时间:2013-08-03 00:31:54

标签: jquery-mobile cordova

有没有人可以帮助我使用闪屏。 我使用jquery mobile创建了我的index.html,everthing很好,但我需要一个闪屏。

<html>
    <head>
        <title>Mobilizm</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href="css/jquery.mobile-1.3.2.min.css" rel="stylesheet" />
    </head>
    <body onload="onLoad()">
        <div data-role="page">
            <div data-theme="b" data-role="header">
                <h3>Mobilizm</h3>
            </div>
            <div data-role="content">
                <div data-role="fieldcontain">
                    <ul data-role="listview">
                        <li><a href="Reservation.html">Rezervasyon Yap</a></li>
                        <li><a href="#">Rezervasyonlarımı Gör</a></li>
                        <li><a href="#">Bilgilerim</a></li>
                    </ul>
                </div>
            </div>
            <div data-theme="b" data-role="footer" data-position="fixed">
                <h3>Mobilizm</h3>
            </div>
        </div>
        <script src="js/jquery.js"></script>
        <script src="js/jquery.mobile-1.3.2.js"></script>
    </body>
</html>

我添加了我的config.xml文件但是当我打开我的应用程序时,没有启动画面

有什么想法吗?

配置XML:

  <?xml version="1.0" encoding="UTF-8"?>
    <widget xmlns = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id = "HelloWorld.Application"
        version = "1.0.0"
        versionCode = "1">

    <name>Mobilizm</name>

    <description>
        Mobilizm mobile application for android
    </description>

    <author href="#" email="polattt@gmail.com">
        Daniele Veneroni
    </author>


    <!-- SPLASH SCREENS -->

    <gap:splash src="css/splash/splash.png" /> <!-- default 320x480 pixels -->

    <!--<gap:splash src="css/splash/ios/splash320x480.png" gap:platform="ios" width="320" height="480" /> --><!-- iPhone 3G, 3GS, iPod Touch 2, 3 --><!--
    <gap:splash src="css/splash/ios/splash640x960.png" gap:platform="ios" width="640" height="960" /> --><!-- iPhone 4, 4S, iPod Touch 4 --><!--
    <gap:splash src="css/splash/ios/splash640x1136.png" gap:platform="ios" width="640" height="1136" /> --><!-- iPhone 5, iPod Touch 5 --><!--
    <gap:splash src="css/splash/ios/splash1024x768.png" gap:platform="ios" width="1024" height="768" /> --><!-- iPad 1, 2, iPad mini --><!--
    <gap:splash src="css/splash/ios/splash768x1024.png" gap:platform="ios" width="768" height="1024" /> --><!-- iPad 1, 2, iPad mini --><!--
    <gap:splash src="css/splash/ios/splash2048x1496.png" gap:platform="ios" width="2048" height="1496" /> --><!-- iPad 3, 4 --><!--
    <gap:splash src="css/splash/ios/splash1536x2008.png" gap:platform="ios" width="1536" height="2008" /> --><!-- iPad 3, 4 -->

    <gap:splash src="css/splash/android/ldpi.png" gap:platform="android" gap:density="ldpi" /> <!-- 200x320 -->
    <gap:splash src="css/splash/android/mdpi.png" gap:platform="android" gap:density="mdpi" /> <!-- 320x480 -->
    <gap:splash src="css/splash/android/hdpi.png" gap:platform="android" gap:density="hdpi" /> <!-- 480x800 -->
    <gap:splash src="css/splash/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" /> <!-- 720x1280 -->



    <!-- GENERAL PREFERENCES -->

    <preference name="phonegap-version" value="2.9.0" />
    <preference name="orientation" value="default" />
    <preference name="target-device" value="universal" />
    <preference name="fullscreen" value="true" /> <!-- remove the upper bar on iOS and Android -->

    <!-- iOS PREFERENCES -->

    <preference name="webviewbounce" value="false" />
    <preference name="prerendered-icon" value="true" />
    <preference name="stay-in-webview" value="false" />
    <preference name="ios-statusbarstyle" value="black-opaque" />
    <preference name="detect-data-types" value="false" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="show-splash-screen-spinner" value="false" />
    <preference name="auto-hide-splash-screen" value="true" /> <!-- if set to false, the splash screen must be hidden using a JavaScript API -->

    <!-- ANDROID PREFERENCES -->

    <preference name="android-minSdkVersion" value="7" /> <!-- minimum Android 2.1 --> 
    <preference name="android-installLocation" value="auto" />
    <preference name="splash-screen-duration" value="3000" />
    <preference name="load-url-timeout" value="20000" />

    <!-- BLACKBERRY PREFERENCES -->

    <preference name="disable-cursor" value="false" />

    <!-- PHONEGAP API FEATURES PREFERENCES -->

    <preference name="permissions" value="none"/>

</widget>

4 个答案:

答案 0 :(得分:2)

Mastazi感谢您的关注,

我终于解决了这个问题。没有脚本需要。更改图像的大小后,它工作。我在上面编辑了我的xml

答案 1 :(得分:1)

我认为你不需要任何脚本。你只需在src文件夹中添加图像就像在android中的本机应用程序一样。

答案 2 :(得分:0)

更新这不是正确的答案。请参阅OP自己的答案。

看起来您没有编写javascript来加载head标记内的splashcreen。类似的东西(例子来自http://docs.phonegap.com/en/2.2.0/cordova_splashscreen_splashscreen.md.html的文档):

    // Wait for Cordova to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // Cordova is ready
    //
    function onDeviceReady() {
        navigator.splashscreen.show();
}

答案 3 :(得分:0)

只需在您的java文件中添加: splash是文件夹中的PNG文件名:drawable

public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.setIntegerProperty("splashscreen", R.drawable.splash);
        // Set by <content src="index.html" /> in config.xml
        super.loadUrl(Config.getStartUrl(),3000);
    }