gpt4 book ai didi

android - 构建后 android phonegap 1.9 中未显示启动画面

转载 作者:行者123 更新时间:2023-11-29 21:58:11 25 4
gpt4 key购买 nike

我正在使用 phonegap 1.9、android、eclipse 4.2、jquerymobile 我想显示闪屏。我用过这个 article .它在 android 模拟器中工作正常,但是当我使用 build.phonegap.com/apps/MyAppId/builds 构建应用程序并在 ipad 上运行它时,默认启动画面出现在这里是我的代码,我将图标和 spalshscreen 图像放在它们各自的文件夹中

java Activity 代码

 public class MyPhoneGapActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.ic_launcher);
super.loadUrl("file:///android_asset/www/index.html",5000);
}
}

javascript代码

 <script type="text/javascript" charset="utf-8">

var onDeviceReady = function() {
cordova.exec(null, null, "SplashScreen", "hide", []);
document.getElementById("devready").innerHTML = "";
};

function CheckDeviceReady() {
document.addEventListener("deviceready", onDeviceReady, true);
}

</script>

<body onload="CheckDeviceReady();" id="stage" class="theme">
<div id="devready" data-theme="b">Device not ready..</div>
</body>

最佳答案

PhoneGap 只构建您的网络 Assets 。它不构建任何 native 源代码 (MyPhoneGapActivity.java)。你可以在 Eclipse 项目的 bin 文件夹中找到 .apk 文件

在 www 文件夹中创建 config.xml 文件并将启动图像放在 "splash/android/" 文件夹中,然后在 phonegap 站点中构建。有关详细信息,请参阅 https://build.phonegap.com/docs/config-xml

www/config.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 = "com.phonegap.example"
version = "1.0.0">
<name>Sample</name>
<description>
Sample
</description>
<preference name="phonegap-version" value="2.0.0" />

<!-- Icons -->
<icon src="icon.png" />

<icon src="icons/ios/icon.png" width="57" height="57" />
<icon src="icons/ios/icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="icons/ios/icon_at_2x.png" width="114" height="114" />

<icon src="icons/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
<icon src="icons/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
<icon src="icons/android/hdpi.png" gap:platform="android" gap:density="hdpi" />


<!-- Splash Screens -->
<preference name="orientation" value="default" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="false" />
<preference name="show-splash-screen-spinner" value="false" />

<gap:splash src="splash.png" />

<gap:splash src="splash/ios/Default.png" width="320" height="480" />
<gap:splash src="splash/ios/Default_at_2x.png" width="640" height="960" />
<gap:splash src="splash/ios/Default-Landscape.png" width="1024" height="768" />
<gap:splash src="splash/ios/Default-Portrait.png" width="768" height="1024" />

<gap:splash src="splash/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
<gap:splash src="splash/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
<gap:splash src="splash/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
<gap:splash src="splash/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />

</widget>

关于android - 构建后 android phonegap 1.9 中未显示启动画面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12669684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com