Android - 启动器图标大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12768128/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 12:02:42  来源:igfitidea点击:

Android - Launcher Icon Size

androidandroid-icons

提问by AndroidDev

For HDPI, XHDPI, etc. what should be the ideal size of the launcher icon? Should I have to create 9-Patchimages for the icon to scale automatically, or would it be better to create separate icons?

对于HDPIXHDPI等,启动器图标的理想尺寸应该是多少?我应该9-Patch为图标创建图像以自动缩放,还是创建单独的图标会更好?

回答by edwoollard

I would create separate images for each one:

我会为每个图像创建单独的图像:

LDPI should be 36 x 36.

MDPI should be 48 x 48.

TVDPI should be 64 x 64.

HDPI should be 72 x 72.

XHDPI should be 96 x 96.

XXHDPI should be 144 x 144.

XXXHDPI should be 192 x 192.

Then just put each of them in the separate stalks of the drawable folder.

然后只需将它们每个放在 drawable 文件夹的单独茎中。

You are also required to give a large version of your icon when uploading your app onto the Google Play Store and this should be WEB 512 x 512. This is so large so that Google can rescale it to any size in order to advertise your app throughout the Google Play Store and not add pixelation to your logo.

将您的应用上传到 Google Play 商店时,您还需要提供大版本的图标,这应该是WEB 512 x 512. 它是如此之大,以至于 Google 可以将其重新缩放到任何大小,以便在整个 Google Play 商店中宣传您的应用程序,而不是在您的徽标中添加像素化。

Basically, all of the other icons should be in proportion to the 'baseline' icon, MDPI at 48 x 48.

基本上,所有其他图标都应该与“基线”图标成比例MDPI at 48 x 48

LDPI is MDPI x 0.75.

TVDPI is MDPI x 1.33.

HDPI is MDPI x 1.5.

XHDPI is MDPI x 2.

XXHDPI is MDPI x 3.

XXXHDPI is MDPI x 4.

This is all explained on the Iconography page of the Android Developers website: http://developer.android.com/design/style/iconography.html

这在 Android 开发者网站的 Iconography 页面上都有解释:http: //developer.android.com/design/style/iconography.html

回答by Chirag

Don't Create 9-patch images for launcher icons . You have to make separate image for each one.

不要为启动器图标创建 9 个补丁图像。您必须为每个图像制作单独的图像。

LDPI - 36 x 36
MDPI - 48 x 48
HDPI - 72 x 72
XHDPI - 96 x 96
XXHDPI - 144 x 144
XXXHDPI - 192 x 192.
WEB - 512 x 512 (Require when upload application on Google Play)

Note: WEB(512 x 512) image is used when you upload your android application on Market.

注意:当您在 Market 上上传您的 android 应用程序时,将使用 WEB(512 x 512) 图像。

|| Android App Icon Size ||

|| Android 应用程序图标大小 ||

All Devices

所有设备

hdpi=281*164
mdpi=188*110
xhdpi=375*219
xxhdpi=563*329
xxxhdpi=750*438

48 × 48 (mdpi)
72 × 72 (hdpi)
96 × 96 (xhdpi)
144 × 144 (xxhdpi)
192 × 192 (xxxhdpi)
512 × 512 (Google Play store)

回答by STS

Android icons require five separate sizes for different screen pixel densities. Icons for lower resolution are created automatically from the baseline.

针对不同的屏幕像素密度,Android 图标需要五种不同的尺寸。较低分辨率的图标是从基线自动创建的。

mdpi (Baseline): 160 dpi 1×
hdpi: 240 dpi 1.5×
xhdpi: 320 dpi 2×
xxhdpi: 480 dpi 3×
xxxhdpi: 640 dpi 4× (launcher icon only)

Launcher icons (.Png)

启动器图标 (.Png)

48 × 48 (mdpi)
72 × 72 (hdpi)
96 × 96 (xhdpi)
144 × 144 (xxhdpi)
192 × 192 (xxxhdpi)
512 × 512 (Google Play store)

Action bar, Dialog & Tab icons

操作栏、对话框和选项卡图标

24 × 24 area in 32 × 32 (mdpi)
36 × 36 area in 48 × 48 (hdpi)
48 × 48 area in 64 × 64 (xhdpi)
72 × 72 area in 96 × 96 (xxhdpi)
96 × 96 area in 128 × 128 (xxxhdpi)*

Notification icons

通知图标

22 × 22 area in 24 × 24 (mdpi)
33 × 33 area in 36 × 36 (hdpi)
44 × 44 area in 48 × 48 (xhdpi)
66 × 66 area in 72 × 72 (xxhdpi)
88 × 88 area in 96 × 96 (xxxhdpi)*

Small Contextual Icons

小的上下文图标

16 × 16 (mdpi)
24 × 24 (hdpi)
32 × 32 (xhdpi)
48 × 48 (xxhdpi)
64 × 64 (xxxhdpi)*

The xxxhdpi size needed only by the launcher icon as the Supporting multiple Screensofficial site says.

正如Supporting multiple Screens官方网站所说,只有启动器图标需要的 xxxhdpi 大小。

回答by Suragch

Adaptive Icons

自适应图标

Starting with Android 8.0 there are adaptive icons, which are made up of two separate layers. Both layers are 108 x 108 dp.

从 Android 8.0 开始,有自适应图标,它们由两个独立的层组成。两层都是 108 x 108 dp。

enter image description here

在此处输入图片说明

(image adapted from Android documentation)

(图片改编自Android 文档

Sizes

尺寸

If you are supporting versions below Android 8.0, you still need to include the legacy sizes (48dp). I marked the pixel sizes in red for each resolution below.

如果您支持低于 Android 8.0 的版本,您仍然需要包含旧尺寸 ( 48dp)。我用红色标记了下面每个分辨率的像素大小。

enter image description here

在此处输入图片说明

Don't do it by hand

不要手工操作

I suppose you could make all of those by hand if you want to, but I have to say that my days of doing that are over. The Android Studio 3.0 Asset Studiois quite good and will generate them all for you. All you have to do is supply a sufficiently large foreground and background image. (I used a 1024 x 1024 px image).

如果你愿意,我想你可以手工制作所有这些,但我不得不说我这样做的日子已经结束了。Android Studio 3.0 Asset Studio非常好,会为您生成它们。您所要做的就是提供足够大的前景和背景图像。(我使用了 1024 x 1024 像素的图像)。

To open the Asset Studio go to File > New > Image Asset.

要打开 Asset Studio,请转到File > New > Image Asset

enter image description here

在此处输入图片说明

回答by Gayan Weerakutti

No need for third party tools when Android Studio can generate icons for us.

当 Android Studio 可以为我们生成图标时,不需要第三方工具。

  • File-> New-> Image Asset

  • Then choose Launcher Iconsas the Asset Type:

  • Choose a High-res image for the Image file:

  • File-> New->Image Asset

  • 然后选择Launcher Icons作为资产类型:

  • 图像文件选择高分辨率图像

Android Generate Launcher Icons

Android 生成启动器图标

  • Next-> Finishto generate icons
  • Next->Finish生成图标

generate ic laucher icons

生成 ic laucher 图标

Finally update android:iconname field in AndroidManifest.xmlif required.

如果需要,最后更新android:icon名称字段AndroidManifest.xml

回答by LuckyMalaka

Provide at least an 512px X 512px image and use this tool: https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

提供至少 512px X 512px 的图像并使用此工具:https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

It will generate all icons for you in the correct size, inclusive the web image for the play store.

它将为您生成正确大小的所有图标,包括 Play 商店的网络图像。

回答by rajlaxmi_jagdale

LDPI should be 36 x 36.

LDPI 应为 36 x 36。

MDPI 48 x 48.

MDPI 48 x 48。

TVDPI 64 x 64.

TVDPI 64 x 64。

HDPI 72 x 72.

HDPI 72 x 72。

XHDPI 96 x 96.

XHDPI 96 x 96。

XXHDPI 144 x 144.

XXHDPI 144 x 144。

XXXHDPI 192 x 192.

XXXHDPI 192 x 192。

回答by android developer

According to the Material design guidelines (here, under "DP unit grid"), your product icon should be of size 48 dp, with a padding of 1dp, except for the case of XXXHDPI, where the padding should be 4dp.

根据材料设计指南(此处,在“DP 单位网格”下),您的产品图标大小应为 48 dp,内边距为 1dp,但 XXXHDPI 的情况除外,内边距应为 4dp。

So, in pixels, the sizes are:

因此,以像素为单位,大小为:

  • 48 × 48 (mdpi) , with 1 dp padding
  • 72 × 72 (hdpi), with 1 dp padding
  • 96 × 96 (xhdpi), with 1 dp padding
  • 144 × 144 (xxhdpi), with 1 dp padding
  • 192 × 192 (xxxhdpi) , with 4 dp padding
  • 48 × 48 (mdpi) 1 dp 填充
  • 72 × 72 (hdpi),1 dp 填充
  • 96 × 96 (xhdpi),1 dp 填充
  • 144 × 144 (xxhdpi),1 dp 填充
  • 192 × 192 (xxxhdpi),4 dp 填充

I recommend to avoid using VectorDrawable as some launchers don't support it, but I think WEBP should be ok as long as you have your minSdk support transparency for them (API 18 and above - Android 4.3).

我建议避免使用 VectorDrawable,因为有些启动器不支持它,但我认为 WEBP 应该没问题,只要你的 minSdk 支持它们的透明度(API 18 及更高版本 - Android 4.3)。

If you publish on the Play Store, the requirement to what to upload there are (based on here) :

如果您在 Play 商店上发布,则需要上传内容(基于此处):

  • 32-bit PNG (with alpha)
  • Dimensions: 512px by 512px
  • Maximum file size: 1024KB
  • 32 位 PNG(带 alpha)
  • 尺寸:512 像素 x 512 像素
  • 最大文件大小:1024KB

回答by sh0umik

Well as @MartinVonMartinsgrün mentioned Now there is exists Better tools then assert generator in android studio

正如@MartinVonMartinsgrün 提到的,现在有更好的工具然后在 android studio 中断言生成器

For application Icon ( Toolbar , ActionBar , DrawableLeft etc ) Use : http://romannurik.github.io/AndroidAssetStudio/icons-actionbar.html

对于应用程序图标( Toolbar 、 ActionBar 、 DrawableLeft 等)使用:http://romannurik.github.io/AndroidAssetStudio/icons-actionbar.html

For launcher (Application Icon ) Use : https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

对于启动器(应用程序图标)使用:https: //romannurik.github.io/AndroidAssetStudio/icons-launcher.html

But Here are some tricks and way to get the better resolution for icons and launcher icons.

但是这里有一些技巧和方法来获得更好的图标和启动器图标分辨率。

Step 1 :

第1步 :

First go to the https://materialdesignicons.comand choose your icon . Or if you have your icon in good resolution then skip this step . Click the desired icon and click on "Advanced Export" it will open up a window like this below Try to generate as large icon as possible

首先转到https://materialdesignicons.com并选择您的图标。或者,如果您的图标分辨率良好,则跳过此步骤。单击所需的图标,然后单击“高级导出”,它将打开如下所示的窗口尝试生成尽可能大的图标

Then click the "Icon" to generate icon (.png) . Well the trick is try to generate as large icon as possible for high resolution devices and the tools will handle it all for small devices but if you use small icon , while generating the icon for high end devices you will loose the icon resolution .

然后单击“图标”以生成图标 (.png)。那么诀窍是尝试为高分辨率设备生成尽可能大的图标,这些工具将为小型设备处理所有这些,但是如果您使用小图标,同时为高端设备生成图标,您将失去图标分辨率。

Step 2 :

第2步 :

Then go the Tools page and Upload the Iconenter image description here

然后转到工具页面并上传图标在此处输入图片说明

Click the "Custom" if you want to color your icon . No matter what color of icon you are uploading , by using Custom you can generate any color you want . Then choose a name and click "Download .ZIP" . This will download the .zip file with the icon for most of the common resolution . You can copy and paste the res folder in your application project folder and you will see the icon in the drawable section .

如果要为图标着色,请单击“自定义”。无论您上传什么颜色的图标,通过使用自定义,您都可以生成您想要的任何颜色。然后选择一个名称并单击“下载 .ZIP”。这将下载带有大多数常见分辨率图标的 .zip 文件。您可以将 res 文件夹复制并粘贴到您的应用程序项目文件夹中,您将在 drawable 部分看到该图标。

回答by Tony O'Hagan

I've posted a script for generating all platform icons for PhoneGap apps from a single SVG icon file. If you have existing bitmaps, I also include some notes that may help you to generate the SVG vectors from an existing bitmap. This won't work for all bitmaps but may for yours.

我已经发布了一个脚本,用于从单个 SVG 图标文件为 PhoneGap 应用程序生成所有平台图标。如果您有现有的位图,我还包括一些注释,可以帮助您从现有的位图生成 SVG 矢量。这不适用于所有位图,但可能适用于您的位图。