Android 是否可以在config.xml中定义Cordova 3.5中的启动屏幕?

Android 是否可以在config.xml中定义Cordova 3.5中的启动屏幕?,android,ios,xml,cordova,Android,Ios,Xml,Cordova,我很难找到文档来检查是否可以使用config.xml定义初始屏幕 我没有跟踪Git上的./platform目录,因此我在那里放置的任何内容都只能在我的计算机中使用,而不能在其他团队成员中使用 我想做一些看起来像这样的事情: <gap:splash gap:density="ldpi" gap:platform="android" src="res/screen/android/screen-ldpi-portrait.png" /> <gap:splash gap:densit

我很难找到文档来检查是否可以使用config.xml定义初始屏幕

我没有跟踪Git上的./platform目录,因此我在那里放置的任何内容都只能在我的计算机中使用,而不能在其他团队成员中使用

我想做一些看起来像这样的事情:

<gap:splash gap:density="ldpi" gap:platform="android" src="res/screen/android/screen-ldpi-portrait.png" />
<gap:splash gap:density="mdpi" gap:platform="android" src="res/screen/android/screen-mdpi-portrait.png" />
<gap:splash gap:density="hdpi" gap:platform="android" src="res/screen/android/screen-hdpi-portrait.png" />
<gap:splash gap:density="xhdpi" gap:platform="android" src="res/screen/android/screen-xhdpi-portrait.png" />
<gap:splash gap:platform="blackberry" src="res/screen/blackberry/screen-225.png" />

可能吗?

好吧,因为我没有得到这个问题的答案,我将发布对我有效的解决方案

使用Cordova的钩子,我可以将启动屏幕文件从/www复制到正确的Android和iOS平台目录

钩子位于/hooks/after_prepare/030_resource_files.js中,在准备步骤之后由Cordova执行

这就是我的代码最后的样子:

#!/usr/bin/env node

// Reference: http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/

//
// This hook copies various resource files from our version control system directories into the appropriate platform specific location
//

var appName = "MyAwesomeApp";

// configure all the files to copy.  Key of object is the source file, value is the destination location.  It's fine to put all platforms' icons and splash screen files here, even if we don't build for all platforms on each developer's box.
var filestocopy = [{
  "www/res/screens/android/drawable/splash.png": "platforms/android/res/drawable/splash.png"
},{
  "www/res/screens/android/drawable-hdpi/splash.png": "platforms/android/res/drawable-hdpi/splash.png"
}, {
  "www/res/screens/android/drawable-ldpi/splash.png": "platforms/android/res/drawable-ldpi/splash.png"
}, {
  "www/res/screens/android/drawable-mdpi/splash.png": "platforms/android/res/drawable-mdpi/splash.png"
}, {
  "www/res/screens/android/drawable-xhdpi/splash.png": "platforms/android/res/drawable-xhdpi/splash.png"
}, {
  "www/res/screens/ios/Resources/splash/Default@2x~iphone.png": "platforms/ios/" + appName + "/Resources/splash/Default@2x~iphone.png"
}, {
  "www/res/screens/ios/Resources/splash/Default-568h@2x~iphone.png": "platforms/ios/" + appName + "/Resources/splash/Default-568h@2x~iphone.png"
}, {
  "www/res/screens/ios/Resources/splash/Default~iphone.png": "platforms/ios/" + appName + "/Resources/splash/Default~iphone.png"
}];

var fs = require('fs');
var path = require('path');

// no need to configure below
var rootdir = process.argv[2];

filestocopy.forEach(function(obj) {
  Object.keys(obj).forEach(function(key) {
    var val = obj[key];
    var srcfile = path.join(rootdir, key);
    var destfile = path.join(rootdir, val);
    //console.log("copying "+srcfile+" to "+destfile);
    var destdir = path.dirname(destfile);
    if (fs.existsSync(srcfile) && fs.existsSync(destdir)) {
      fs.createReadStream(srcfile).pipe(fs.createWriteStream(destfile));
    }
  });
});
仍然很难让它工作,因为有很多部件必须装配在一起才能工作,但正是挂钩帮助我解决了问题

来源:Holly Schinsky的一篇文章中的复制图标和Splashscreens部分非常有用,我从中获取了大部分代码: