1

有没有人可以帮助我启动屏幕。我使用 jquery mobile 创建了我的 index.html,一切都很好,但我需要一个启动画面。

<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

4 回答 4

2

Mastazi 感谢您的关注,

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

于 2013-08-03T02:31:52.647 回答
1

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

于 2013-08-03T07:22:11.113 回答
0

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

看起来您没有编写 javascript 来加载head标签内的启动画面。类似的东西(示例取自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();
}
于 2013-08-03T01:13:46.640 回答
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);
    }
于 2014-01-09T10:46:20.747 回答