--- license: > Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 标题:自定义应用图标 Toc_标题:自定义图标 说明:了解如何为您的 Cordova 应用程序自定义图标。 --- • 自定义图标 本节演示如何为各种平台配置应用程序的图标。有关初始屏幕图像的文档可以在 Cordova-Plugin-Splash 屏幕文档 [飞溅屏幕插件文档] [飞溅屏幕]插件]中找到。 • 配置 CLI 中的图标 在 CLI 中工作时,您可以通过""元素 (' Config.xml') 定义应用程序图标 (s)。 如果不指定图标,则使用 Apache Cordova 徽标。 ' XML • 图标 src = " RES/iOS/icon.png" 平台 • " ios" 宽度 • " 57" 高度 • " 57" 密度 = " mdpi/] ``` 属性 |描述 --------------|-------------------------------------------------------------------------------- Src |• 所需 =
图像文件的位置,相对于您的项目目录 平台 |• 可选 •
目标平台 宽度 |• 可选 =
图标宽度(以像素为单位) 高度 |• 可选 •
图标高度(以像素为单位) 密度 |• 可选 •
• • • 安卓 •
指定的图标密度 目标 |• 可选 =
• • Windows = 图像文件及其所有 MRT 配套
目标文件名 以下配置可用于定义单个默认图标 它将用于所有平台。 ' XML • 图标 src = = "RES/图标.png"/* ``` 对于每个平台,您还可以定义一个像素完美的图标集,以适合 不同的屏幕分辨率。 ##Android ```xml ``` ###See Also - [Android icon guide](https://www.google.com/design/spec/style/icons.html) - [Android - Supporting multiple screens](http://developer.android.com/guide/practices/screens_support.html) ##BlackBerry10 ```xml ``` ###See Also - [BlackBerry's documentation][blackberry_icon] for targeting multiple sizes and locales. ##Browser Icons are not applicable to the Browser platform. ##iOS ```xml ``` ###See Also - [App Icons on iPad and iPhone](https://developer.apple.com/library/content/qa/qa1686/_index.html) ##Windows For Windows the recommended approach to define application icons is to use the `target` attribute. ```xml ``` where `src` is the path to the icon which needs to be added. The Windows platform handles MRT icons automatically, so if you specify `src="res/windows/storelogo.png"` the following files will be copied into the application's `images` folder: `res/windows/storelogo.scale-100.png`, `res/windows/storelogo.scale-200.png`, etc. TODO Define what MRT is. The `target` attribute specifies the base name for the resultant icons. For every icon file, its destination filename is calculated as `target + '.' + MRT_qualifiers + extension(src)`. For the icons to display properly in the application, every `target` value should be one of the icon filenames defined in the application's `.appxmanifest` file. Summarizing the above... using the `target` attribute it is possible to: * define a group of icons for different device scale factors using a single `` element, for example: ```xml ``` which is equivalent to the following lines: ```xml ``` * define icons with scale factors other than `scale-100` and `scale-240` (and any other MRT qualifiers) Although it is not recommended, it is also possible to define icons using the `width` and `height` attributes: ```xml ``` ###See Also: - [Windows 10 platform guidelines for icons](https://msdn.microsoft.com/en-us/library/windows/apps/mt412102.aspx). - [Windows 8.1 tiles and icons sizes](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh781198.aspx) ##Windows Phone 8 (WP8 Platform) ```xml ``` [blackberry_icon]: http://developer.blackberry.com/html5/documentation/icon_element.html [splashscreen_plugin]: ../reference/cordova-plugin-splashscreen/