简体   繁体   English

Cordova-CLI和图标(不包含)

[英]Cordova-CLI and Icons (aren't included)

I'm using Cordova CLI 4.2.1 in my project, but I'm unable to get icons working. 我在项目中使用Cordova CLI 4.2.1,但无法使图标正常工作。 I've put all the icons as described in the docs into www/res/icons . 我已将文档中所述的所有图标放入www/res/icons (Note: Due to the documentation the folder should have already existed with the defaults icons in it, but there wasn't any folder in my projected created via the CLI) (注意:由于文档的原因,该文件夹中应该已经存在带有默认图标的文件夹,但是我的项目中没有通过CLI创建的任何文件夹)

But the icons aren't copied into the bundle after building the app. 但是,构建应用程序后,图标不会复制到捆绑软件中。 When searching the web I found a lot of links saying to manually copy them into the projects. 在网络上搜索时,我发现有很多链接说要手动将它们复制到项目中。 This may work but this is pain since this would get done after every build. 这可能有效,但这很痛苦,因为这将在每次构建后完成。

Another link on the web told me to add <icon src="res/icons/" /> to my config.xml but this doesn't helped too. 网络上的另一个链接告诉我将<icon src="res/icons/" />到我的config.xml但这也无济于事。

(Another note: The project is created like described in the docs and is just bare bone. So there shouldn't be anything else preventing this from working.) (另一个注意事项:该项目的创建与文档中所述的一样,只是一个简单的框架。因此,不应有任何其他措施阻止该项目的工作。)

I was previously using phonegap CLI (3.0 till 3.3) and www/res/icons were here when creating new project but actually not copied to the platforms when creating platform or building. 我以前使用的是phonegap CLI(3.0到3.3),而在创建新项目时在这里使用了www / res / icons,但是在创建平台或构建时却没有将其复制到平台上。 Actually they were used only for phonegap build. 实际上,它们仅用于构建电话间隙。

I'm now using cordova 3.4 and www/res is no more created. 我现在使用的是cordova 3.4,不再创建www / res。

The default icons are created by the cli when you add the platform to the project. 将平台添加到项目时,默认图标由cli创建。 You can change the icons after you add the platform, the CLI will not touch them when you build, so you only have to to it once for each platform. 添加平台后,您可以更改图标,构建时CLI不会触摸它们,因此每个平台只需要对它进行一次操作。

The res/icons folder and files are only for the PhoneGap Build service. res/icons文件夹和文件仅用于PhoneGap Build服务。 With Cordova you manually add these after installing the platform to your project. 使用Cordova,您可以在将平台安装到项目中之后手动添加它们。

For iOS you use the functionality that Xcode provides. 对于iOS,您可以使用Xcode提供的功能。

For Android you add them in platforms/android/res/drawable and additionally to the other drawable-XXX folders if you wish to support the various display types. 对于Android,如果您希望支持各种显示类型,则将它们添加到platforms/android/res/drawable并另外添加到其他drawable-XXX文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM