我在config.xml中设置了启动画面,甚至在platforms/android/res/drawable-RESOLUTIONS/splash.png
但是,使用命令行phonegap local build android --device
构建它会显示没有启动画面。只有一个空白的白色屏幕大约一秒钟。
在构建文件夹中不会复制图标和启动画面也很奇怪。我必须在那里手动复制它们。这是一个已知的错误吗?
文件夹结构:http://cl.ly/image/091v0D2o2s3O
我的config.xml:
<preference name="permissions" value="none"/>
<!-- Customize your app and platform with the preference element. -->
<!-- <preference name="phonegap-version" value="3.4.0" /> --> <!-- all: current version of PhoneGap -->
<preference name="orientation" value="default" /> <!-- all: default means both landscape and portrait are enabled -->
<preference name="target-device" value="universal" /> <!-- all: possible values handset, tablet, or universal -->
<preference name="fullscreen" value="true" /> <!-- all: hides the status bar at the top of the screen -->
<preference name="webviewbounce" value="true" /> <!-- ios: control whether the screen 'bounces' when scrolled beyond the top -->
<preference name="prerendered-icon" value="true" /> <!-- ios: if icon is prerendered, iOS will not apply it's gloss to the app's icon on the user's home screen -->
<preference name="stay-in-webview" value="false" /> <!-- ios: external links should open in the default browser, 'true' would use the webview the app lives in -->
<preference name="ios-statusbarstyle" value="black-opaque" /> <!-- ios: black-translucent will appear black because the PhoneGap webview doesn't go beneath the status bar -->
<preference name="detect-data-types" value="true" /> <!-- ios: controls whether data types (such as phone no. and dates) are automatically turned into links by the system -->
<preference name="exit-on-suspend" value="false" /> <!-- ios: if set to true, app will terminate when home button is pressed -->
<preference name="show-splash-screen-spinner" value="true" /> <!-- ios: if set to false, the spinner won't appear on the splash screen during app loading -->
<preference name="auto-hide-splash-screen" value="false" /> <!-- ios: if set to false, the splash screen must be hidden using a JavaScript API -->
<preference name="disable-cursor" value="false" /> <!-- blackberry: prevents a mouse-icon/cursor from being displayed on the app -->
<preference name="android-minSdkVersion" value="7" /> <!-- android: MIN SDK version supported on the target device. MAX version is blank by default. -->
<preference name="android-installLocation" value="auto" /> <!-- android: app install location. 'auto' will choose. 'internalOnly' is device memory. 'preferExternal' is SDCard. -->
<preference name="SplashScreenDelay" value="500000" />
<preference name="splash-screen-duration" value="500000" />
<!-- Plugins can also be added here. -->
<!--
<gap:plugin name="Example" />
A list of available plugins are available at https://build.phonegap.com/docs/plugins
-->
<!-- Define app icon for each platform. -->
<icon src="icon.png" />
<icon src="res/icon/android/icon-36-ldpi.png" gap:platform="android" gap:density="ldpi" />
<icon src="res/icon/android/icon-48-mdpi.png" gap:platform="android" gap:density="mdpi" />
<icon src="res/icon/android/icon-72-hdpi.png" gap:platform="android" gap:density="hdpi" />
<icon src="res/icon/android/icon-96-xhdpi.png" gap:platform="android" gap:density="xhdpi" />
<icon src="res/icon/ios/icon-57.png" gap:platform="ios" width="57" height="57" />
<icon src="res/icon/ios/icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="res/icon/ios/icon-57-2x.png" gap:platform="ios" width="114" height="114" />
<icon src="res/icon/ios/icon-72-2x.png" gap:platform="ios" width="144" height="144" />
<!-- Define app splash screen for each platform. -->
<gap:splash src="splash.png" />
<gap:splash src="res/screen/android/screen-ldpi-portrait.png" gap:platform="android" gap:density="ldpi" />
<gap:splash src="res/screen/android/screen-mdpi-portrait.png" gap:platform="android" gap:density="mdpi" />
<gap:splash src="res/screen/android/screen-hdpi-portrait.png" gap:platform="android" gap:density="hdpi" />
<gap:splash src="res/screen/android/screen-xhdpi-portrait.png" gap:platform="android" gap:density="xhdpi" />
<gap:splash src="res/screen/ios/Default~iphone.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="res/screen/ios/Default@2x~iphone.png" gap:platform="ios" width="640" height="960" />
<gap:splash src="res/screen/ios/Default-Portrait~ipad.png" gap:platform="ios" width="768" height="1024" />
<gap:splash src="res/screen/ios/Default-Landspace~ipad.png" gap:platform="ios" width="1024" height="768" />
答案 0 :(得分:9)
根据Phonegap 3.5.0的最新文档, http://docs.phonegap.com/en/3.5.0/config_ref_images.md.html
首先,您需要添加splashscreen插件。使用CLI,转到项目目录并执行以下操作:
cordova plugin add org.apache.cordova.splashscreen
之后,将其添加到根目标中的config.xml或www / config.xml(旧版本)
中<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="10000" />
并根据大小将启动画面文件放到相应的可绘制文件夹中,就像刚才那样。确保文件名与&#34;值&#34;参数。
接下来,浏览
平台/机器人/ Ant的构建
并删除其中的所有文件(最重要的一步)。 最后但并非最不重要的是,构建并运行您的phonegap项目。 现在它将使用新的启动屏幕文件。
似乎ant-build并没有自我更新。
答案 1 :(得分:1)
除非它已经变形,否则差距:config.xml中的splash行和res文件夹中的文件仅用于phonegap构建。
您需要将启动画面插件org.apache.cordova.splashscreen添加到项目中,并像原来一样复制本机文件夹中的文件。
答案 2 :(得分:1)
我通过在config.xml文件中添加默认的splash标签来解决了这个问题
将其添加到根目标中的config.xml或www / config.xml
中<gap:splash src="splash.png" />
<gap:splash gap:platform="android" gap:qualifier="port-ldpi" src="res/screen/android/screen-ldpi-portrait.png" />
<gap:splash gap:platform="android" gap:qualifier="port-mdpi" src="res/screen/android/screen-mdpi-portrait.png" />
<gap:splash gap:platform="android" gap:qualifier="port-hdpi" src="res/screen/android/screen-hdpi-portrait.png" />
<gap:splash gap:platform="android" gap:qualifier="port-xhdpi" src="res/screen/android/screen-xhdpi-portrait.png" />
在Phonegap文档中提及: -
http://docs.build.phonegap.com/en_US/configuring_icons_and_splash.md.html