gpt4 book ai didi

android - Phonegap/Cordova 不显示启动画面

转载 作者:行者123 更新时间:2023-11-29 14:22:59 24 4
gpt4 key购买 nike

我已经在 config.xml 中设置了启动画面,甚至在 platforms/android/res/drawable-RESOLUTIONS/splash.png

中手动复制了它们

但是,使用命令行 phonegap local build android --device 构建它没有显示启动画面。只有大约一秒钟的空白屏幕。

图标和启动画面没有被复制到构建文件夹中也很奇怪。我必须在那里手动复制它们。这是已知错误吗?

文件夹结构:http://cl.ly/image/091v0D2o2s3O

我的配置文件:

<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" />

最佳答案

基于Phonegap 3.5.0的最新文档, http://docs.phonegap.com/en/3.5.0/config_ref_images.md.html

首先,您需要添加闪屏插件。使用您的 CLI,转到您的项目目录并执行此操作:

cordova plugin add org.apache.cordova.splashscreen

之后,将其添加到根目录或 www/config.xml(旧版本)中的 config.xml

<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="10000" />

然后像刚才一样把你的splash screen文件按照大小放到相应的drawable文件夹中。确保文件名与带有“值”参数的文件名相同。

下一步,浏览到

platform/android/ant-build

并删除其中的所有文件(最重要的一步)。最后但同样重要的是,构建并运行您的 phonegap 项目。现在它将使用新的启动画面文件。

似乎 ant-build 没有自行更新。

关于android - Phonegap/Cordova 不显示启动画面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22666903/

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