生成iOS和Android的图标科尔多瓦/ PhoneGap的科尔、图标、多瓦、iOS

2023-09-12 22:38:13 作者:快快长大

我有一个新创建的科尔多瓦的项目具有以下的config.xml 设置(从http://docs.phonegap.com/en/edge/config_ref_images.md.html).我还添加了2平台(iOS和Android)。

当我运行任科尔多瓦运行IOS 科尔多瓦运行Android ,该项目仍然有默认的科尔多瓦图标。我从文档的理解是,Corodva应该建立自动设在的icon.png 我提供的的config.xml 。

的config.xml

 < XML版本=1.0编码=UTF-8&GT?;
<微件ID =com.testapp版本=1.1.2的xmlns =htt​​p://www.w3.org/ns/widgets的xmlns:CDV =htt​​p://cordova.apache.org/ns /1.0">
    <名称>&SingleApp LT; /名称>
  < preference名=DisallowOverscroll值=真/>
  < preference名=AutoHideSplashScreen值=FALSE/>
  < preference名=方向值=画像/>
  < preference名=全屏值=FALSE/>
  < preference名=目标设备值=手机/>

  <描述>
      样本的Apache科尔多瓦应用程序响应deviceready事件。
  < /描述>
  <作者电子邮件=dev@cordova.apache.org的href =htt​​p://cordova.io>
      Apache的科尔多瓦队
  < /笔者>
  <内容SRC =的index.html/>
  <获得原产地=*/>

  <图标SRC =的icon.png/>

< /部件>
 

解决方案

我写的自动生成使用ImageMagick的图标科尔多瓦的脚本:

即使更新了iOS,它和Android间的交互差异还未改变

https://github.com/AlexDisler/cordova-icon

要使用它,创建一个的icon.png的文件,并把它放在你的项目的根文件夹,然后运行:

 科尔多瓦图标
 

和它会生成所需的所有图标,为您的项目了。该平台

您也可以将其配置为一个钩子,在科尔多瓦的项目,所以图标将每次构建基于你已经添加了的icon.png项目时生成。 (在自述说明)。

I have a freshly created Cordova project with the following config.xml setup (used the instructions from http://docs.phonegap.com/en/edge/config_ref_images.md.html). I also added 2 platforms (iOS and Android).

When I run either cordova run ios or cordova run android, the project still has the default Cordova icons. My understanding from the documentation is that Corodva is supposed to create the icons automatically based in the icon.png I supplied in the config.xml.

config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.testapp" version="1.1.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>SingleApp</name>
  <preference name="DisallowOverscroll" value="true" />
  <preference name="AutoHideSplashScreen" value="false" />
  <preference name="Orientation" value="portrait" />
  <preference name="Fullscreen" value="false" />
  <preference name="target-device" value="handset" />

  <description>
      A sample Apache Cordova application that responds to the deviceready event.
  </description>
  <author email="dev@cordova.apache.org" href="http://cordova.io">
      Apache Cordova Team
  </author>
  <content src="index.html" />
  <access origin="*" />

  <icon src="icon.png" />

</widget>

解决方案

I wrote a script that auto generates icons for cordova using ImageMagick:

https://github.com/AlexDisler/cordova-icon

To use it, create an "icon.png" file and place it in the root folder of your project, then run:

cordova-icon

and it will generate all the required icons for the platforms your project has.

You can also configure it as a hook in your cordova project so the icons will be generated every time you build the project based on the icon.png you've added. (instructions in the readme).

 
精彩推荐
图片推荐