我们应该如何使用 android 4.4 添加的 mipmap 文件夹?

How should we use the mipmap folders added with android 4.4?

我最近又安装了一个Android SDK到Android Studio,SDK版本4.4(API 19级),在我的项目中使用后,它添加了一套项目 res 文件夹 (res/mipmap) 中的 mipmap 个文件夹。
我既不明白为什么,也不明白如何使用它们。

我读了另一个
答案是:

The mipmap folders are for placing your app icons in only. Any other drawable assets you use should be placed in the relevant drawable folders as before.

According to this Google blogpost:

It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density.

我还是不明白这是为什么。
为什么我们不能将应用程序图标也放在 res/drawable 文件夹中?

另外,如果只有应用程序图标应该放在 mipmap 文件夹中,我如何创建其他可绘制资源并将它们放在 drawable 文件夹中,使用 Android Studio图像资产向导? (通过右键单击项目访问,选择 New > Image Asset

Why cant we just place the app icons in the res/drawable folders too?

哦,可以。 Google不推荐,仅此而已

引自 my book 6.5 版:

While drawable resources might be removed when packaging an APK, such as for the Gradle for Android split system for making density-specific editions of an app, mipmap resources are left alone, apparently

这是因为启动器图标可能是从密度比用于所有其他可绘制对象的常规设备密度更高的桶中提取的。将它们放在 res/mipmap-*/ 目录中意味着我们不会在优化 APK 大小的过程中无意中删除它们。

(为什么他们没有以更好的方式处理这个问题,我不知道)

how do I create other drawable assets and place them in the drawable folders with the Android Studio Image Asset wizard? (Accessed by right clicking in the project, selecting New > Image Asset)

Image Asset 向导仅将启动器图标放在 res/mipmap-*/ 目录中。如果您选择其他图标类型,它们将进入 res/drawable-*/。当然,图像资产向导本身是可选的。