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

只谈情不闲聊 提交于 2019-11-30 21:52:06

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!