进行远程构建时,如何更改cordova/phonegap的默认图标 [英] How can I change the default icon of cordova/phonegap when doing remote build

查看:133
本文介绍了进行远程构建时,如何更改cordova/phonegap的默认图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个Web应用程序html5,javascript,jquery和ajax.我的HelloWorld项目的目录结构是

I developed a web application html5, javascript, jquery and ajax. The directory structure of my HelloWorld project is

HelloWorld
   img
   css
   js
   index.html

我压缩了HelloWorld文件夹并将zip文件上传到 http://build.phonegap.com 进行创建apk文件.我在移动设备上安装了该应用程序,并且运行正常.

I zipped the HelloWorld folder and uploaded the zip file to http://build.phonegap.com for creating the apk file. I installed the app in mobile and it is working fine.

问题是如何更改在构建过程中由Cordova或phonegap分配的我的应用程序的默认图标.我进行了很多搜索,但几乎所有可用答案都显示了在应用程序本地编译和构建时(从平台文件夹中)更改图标的过程

The problem is how to change the default icon of my app which is assigned by Cordova or phonegap during build. I searched a lot but nearly all the answers available show the process of changing the icon when the app is compiled and build locally (from platform folder)

由于我正在使用在线或远程服务,因此无法使用它们.我想知道我将自己的icon.png或logo.png放在哪里,以便在构建过程中将其用作应用程序图标.请让我知道图标中是否还需要任何代码.

Since I am using online or remote service I cant use them. I want to know where I put my own icon.png or logo.png so that it is used as the application icon during build process. Please let me know if any code is also required along with the icon.

推荐答案

好吧,我已经弄清楚了,我正在发布答案以帮助他人.您需要以png格式添加config.xml文件和图标.将图标命名为ldpi.png(36x36),mdpi.png(46x46),hdpi.png(72x72),xdhpi.png(96x96)和icon.png(96x96).您可以使用 http://picresize.com/通过从网站上的选项.将以下代码添加到config.xml中.因此,最终的文件夹/文件结构将为

Okay I figured it out and I am posting the answer to help others. You need to add config.xml file and icons in png format. Name the icons ldpi.png (36x36), mdpi.png (46x46), hdpi.png (72x72), xdhpi.png (96x96) and icon.png (96x96). You can use http://picresize.com/ to convert icons in the specified pixel size by choosing the custom size from the option on the website. Add the following code in to the config.xml. So the final folder/file structure will be

ProjectName
  img
  css
  js
  index.html
  config.xml
  ldpi.png
  mdpi.png
  hdpi.png
  xdhpi.png
  icon.png

现在压缩文件夹并将其上传到 http://build.phonegap.com ,创建的apk将有用户定义的图标.

Now zip the folder and upload it to http://build.phonegap.com and the apk created will have the user defined icons.

<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns   = "http://www.w3.org/ns/widgets"
    xmlns:gap   = "http://phonegap.com/ns/1.0"
    id          = "com.phonegap.bdau"
    versionCode = "10" 
    version     = "1.0.0" >

<!-- versionCode is optional and Android only -->

<name>BigDataAnalyticalUnit</name>

<description>
    Big Data and Analytical Unit 
</description>

<author href="https://imperial.ac.uk" email="abc@gmail1.com">
    Mian Asbat Ahmad
</author>



    <!-- Define app icon for each platform. -->
    <icon src="icon.png" />
    <icon src="ldpi.png" gap:platform="android" gap:qualifier="ldpi" />
    <icon src="mdpi.png" gap:platform="android" gap:qualifier="mdpi" />
    <icon src="hdpi.png" gap:platform="android" gap:qualifier="hdpi" />
    <icon src="xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />
    </widget>

这篇关于进行远程构建时,如何更改cordova/phonegap的默认图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆