Mar*_*der 1 android splash-screen ios cordova
我已经在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" />
Run Code Online (Sandbox Code Playgroud)
基于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
Run Code Online (Sandbox Code Playgroud)
之后,将其添加到根目标中的config.xml或www/config.xml(旧版本)中
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="10000" />
Run Code Online (Sandbox Code Playgroud)
并根据大小将启动画面文件放到相应的可绘制文件夹中,就像刚刚做的那样.确保文件名与带有"value"参数的文件名相同.
接下来,浏览到
平台/安卓/ Ant的构建
并删除其中的所有文件(最重要的一步).最后但并非最不重要的是,构建并运行您的phonegap项目.现在它将使用新的启动屏幕文件.
似乎ant-build并没有自我更新.
| 归档时间: |
|
| 查看次数: |
5574 次 |
| 最近记录: |