我们应该如何使用了Android 4.4增加了多重映像文件夹? [英] How should we use the mipmap folders added with android 4.4?

查看:179
本文介绍了我们应该如何使用了Android 4.4增加了多重映像文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了一个更多的Andr​​oid SDK到Android工作室的SDK版本4.4(API级别19),并用它与我的项目后,它增加了一组纹理映射项目的 RES文件夹文件夹( RES /纹理映射)。
我也不明白为什么,以及如何使用它们。

我读到这里的SO 另一个问题。
它的答案说:

  

多重映像文件夹放置你的应用程序图标而已。任何其他   使用可拉伸资产应放置在相关的可拉伸   文件夹和以前一样。

     

据的这个谷歌的博文

     
    

这是最好的做法是把你的应用程序图标中的纹理映射 - 文件夹(而不是drawable-文件夹),因为它们使用的分辨率     不同从装置的电流密度

  

我还是不明白原因了这一点。
为什么不能,我们只需将应用程序图标中的 RES /绘制文件夹吗?

另外,如果只有应用程序图标应放置在纹理映射文件夹,如何创建等绘制的资产,并将其放置在绘制的Andr​​oid工作室图片资产向导文件夹? (右键单击该项目进入,选择新建>图像资产

解决方案
  

为什么不能我们只需将应用程序图标在res /绘制文件夹吗?

哦,你可以。谷歌不推荐它,这就是全部。

从版本6.5引用自己的我的书

  

虽然   包装的APK,如用于当提拉资源可能会被删除   摇篮为Android拆分系统制作一个应用程序密度的具体版本,   纹理映射资源被单独留在家中,显然

这是因为发射器图标可能从比用于所有其它可绘制的常规设备密度更高密度的桶被拉动。将它们放在 RES /纹理映射 - * / 目录意味着我们不会在不经意间摆脱他们作为优化APK大小的一部分

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

  

如何创建其他绘制资产,将它们放置在与Android的工作室图像资源精灵绘制文件夹? (右键单击该项目进入,选择New>图像资产)

图片资产向导只把启动图标 RES /纹理映射 - * / 目录。如果你选择了其他图标类型,它们会在 RES /绘制 - * / 。而且,当然,在图像向导资产本身是可选的。

I recently installed one more Android SDK to Android Studio, the SDK version 4.4 (API level 19), and after using it with my project, it added a set of mipmap folders in the project's res folder (res/mipmap).
I neither understand why, or how to use them.

I read another question about it here on SO.
The answer to it said that:

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.

I still don't get the reason to this.
Why cant we just place the app icons in the res/drawable folders too?

Also, if only the app icon should be placed in the mipmap folders, 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)

解决方案

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

Oh, you can. Google doesn't recommend it, that's all.

Quoting myself from Version 6.5 of my book:

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

This is because launcher icons may be pulled from a higher-density bucket than the regular device density that is used for all other drawables. Putting them in res/mipmap-*/ directories means that we won't inadvertently get rid of them as part of optimizing APK size.

(why they didn't handle this in a better way, I have no idea)

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)

The Image Asset wizard only puts launcher icons in res/mipmap-*/ directories. If you choose the other icon types, they will go in res/drawable-*/. And, of course, the Image Asset wizard itself is optional.

这篇关于我们应该如何使用了Android 4.4增加了多重映像文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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