我正在研究phonegap 1.9,android,eclipse 4.2,jquerymobile我想显示启动画面。我使用了这个article。它在Android模拟器中工作正常但是当我使用build.phonegap.com/apps/MyAppId/builds构建应用程序并在ipad默认启动屏幕上运行它出现在这里是我的代码,我已经在各自的文件夹中放置了图标和spalshscreen图像
java活动代码
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>
答案 0 :(得分:2)
PhoneGap仅构建您的网络资源。它不构建任何本机源代码(MyPhoneGapActivity.java)。您可以在Eclipse项目 bin 文件夹中找到 .apk 文件
在www文件夹中创建config.xml文件,并将splash图像放在“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>
答案 1 :(得分:0)
大多数情况下编辑config.xml很困难 现在,您可以使用GUI工具编辑config.xml,从此处下载 http://configap.com/