在哪里放置应用程序图标和启动屏幕文件?

Ash*_*777 2 phonegap-build phonegap-cli

由于PhoneGap构建说只上传www.zip文件夹,所以我无法理解我必须为每个平台放置图标和启动画面文件夹.我应该把它放在www里面吗?

提出这个问题的原因是,如果我们应该只保留图标并且只在www内部,那么我的应用程序将变得非常沉重,不必要的图标和启动画面文件将被添加到我的应用程序中,因为我的应用程序是跨平台的,并且我为所有平台都包含了图标和飞溅.

如果我们脱机工作(PhoneGap CLI),那么我们曾经将文件保存在www文件夹之外的res中,而Cordova构建过程只会自动复制特定于平台的图标和启动屏幕文件,但在这里它将添加所有文件,即使是必需的对于选定的平台.

Rac*_*lan 6

正如您已经想到的那样,PhoneGap Build的项目结构略有不同.是的,你只需压缩并上传www文件夹,别无其他.顺便说一句,zip文件的名称不一定是www.zip,它可以是其他任何东西,但它必须只包含www文件夹,或者更好的只包含没有文件夹本身的www文件夹的内容.

你需要在www根文件夹中有icon.png和splash.png作为默认图标和启动画面.然后为其他图像添加子文件夹.您可以使用任意数量的文件夹将其命名为res或任何名称,但在其根目录中添加名为".pgbomit"的空文件,这将告诉PhoneGap Build仅包含此文件夹中所需的文件,如您所提到的.然后使用config.xml中的完整路径引用每个文件,该路径也必须位于www根文件夹中.

所以结构应该是这样的:

www
   res
      icon
          android
          ios
      splash
          android
          ios
   config.xml
   icon.png
   splash.png
   index.html

与图标和启动画面相关的config.xml部分应该是这样的(在版本5及更高版本中):

  <icon src="icon.png" />
  <splash src="splash.png" />
  <platform name="ios">
    <icon src="res/icon/ios/icon.png" width="57" height="57" />
    <icon src="res/icon/ios/icon@2x.png" width="114" height="114" />
    <icon src="res/icon/ios/icon-72.png" width="72" height="72" />
    <icon src="res/icon/ios/icon-72@2x.png" width="144" height="144" />
    <icon src="res/icon/ios/icon-60.png" width="60" height="60" />
    <icon src="res/icon/ios/icon-60@2x.png" width="120" height="120" />
    <icon src="res/icon/ios/icon-60@3x.png" width="180" height="180" />
    <icon src="res/icon/ios/icon-76.png" width="76" height="76" />
    <icon src="res/icon/ios/icon-76@2x.png" width="152" height="152" />
    <splash src="res/splash/ios/Default~iphone.png" width="320" height="480"/>
    <splash src="res/splash/ios/Default@2x~iphone.png" width="640" height="960"/>
    <splash src="res/splash/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="res/splash/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="res/splash/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
    <splash src="res/splash/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
    <splash src="res/splash/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="res/splash/ios/Default-667h.png" width="750" height="1334"/>
    <splash src="res/splash/ios/Default-736h.png" width="1242" height="2208"/>
    <splash src="res/splash/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
  </platform>
Run Code Online (Sandbox Code Playgroud)

以上配置适用于iOS,因此请为您希望支持的其他平台添加类似的部分,但如上面的iOS部分,请确保您遵循其他平台中正确的图像大小和名称.