Drawable和Mipmap资源的区别

区别

在apk安装的时候,mipmap-xxx/下的所有分辨率的图片都会保留,而drawablexxx/下的图片只有保留适配设备分辨率的图片,其余图片会丢弃掉,减少了APP安装大小。

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。——from Android Developers Blog

Using a mipmap as the source for your bitmap or drawable is a simple way to provide a quality image and various image scales, which can be particularly useful if you expect your image to be scaled during an animation. ——from android-4.3

if you are building different versions of your app for different densities, you should know about the "mipmap" resource directory. This is exactly like "drawable" resources, except it does not participate in density stripping when creating the different apk targets. ——from Google+ Message

用法

  • mipmapxxx/下放置APP启动图标,以及需要高质量缩放动画的图片。

  • 其他图片资源放在drawablexxx/下。


参考

  • Android Developers Blog
  • android-4.3
  • Google+ Message

注:文章首发和我的个人博客永恒的码流。


你可能感兴趣的:(Drawable和Mipmap资源的区别)