对于HDPI, XHDPI等,理想的启动器图标的大小应该是什么?我应该为图标创建9-Patch图像来自动缩放,还是创建单独的图标会更好?


当前回答

自适应的图标

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

(图片来自Android文档)

大小

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

不要用手做

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

打开资产工作室,去文件>新建>图像资产。

其他回答

你可以直接在android studio中创建图标。你需要遵循的步骤是:

1.右击Res->New->图像资产

2.将资产类型更改为图像。

3.从本地磁盘加载映像

4.你可以选择修剪,改变填充和添加背景也。如果需要,可以更改值。

5.单击Next - > Finish。

该图像将自动添加到mimmap -mdpi, mimmap -hdpi, mimmap -xhdpi, mimmap -xxhdpi, mimmap -xxxhdpi,如果您选择启动器图标或mimmap -xxxhdpi 如果您选择其他图标选项,则可绘制mdpi,可绘制hdpi,可绘制xhdpi,可绘制xxhdpi,可绘制xxxhdpi。

自适应的图标

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

(图片来自Android文档)

大小

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

不要用手做

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

打开资产工作室,去文件>新建>图像资产。

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

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

LDPI应该是36 x 36。

MDPI 48×48。

电视DPI 64 x 64。

HDPI 72 x 72。

XHDPI 96 x 96。

XXHDPI 144 x 144。

XXXHDPI 192 x 192。

I had the same problem but then realized the arrangement of my icon graphic within the square allowed (512 x 512 in my case) was not maximized. So I rotated the image and was able to scale it up to fill the corners better. Then I right clicked on my res folder in my project in Android Studio, then choose New then Image Asset, it took me through a wizard where I got to select my image file to use. Then if you check the box that says "Trim surrounding blank space", it makes sure all edges, that are able, touch the sides of your square. These steps got it much bigger than the original.