【Android】drawable VS mipmap

Android Studio 创建工程后默认的资源文件夹如下图所示:

一直有些疑惑的是 mipmapdrawable 文件夹有什么区别,以及是否还需要创建 drawable-xhdpi, drawable-xxhdpi 等文件夹来存放更高分辨率的图片。

Stack Overflow 上有关的解释如下:

The mipmap folders are for placing your app/launcher icons (which are shown on the homescreen) in only. Any other drawable assets you use should be placed in the relevant drawable folders as before.

官方博客的解释:
mipmap 文件夹:

res/
   mipmap-mdpi/
      ic_launcher.png
   mipmap-hdpi/
      ic_launcher.png
   mipmap-xhdpi/
      ic_launcher.png  
   mipmap-xxhdpi/
      ic_launcher.png
   mipmap-xxxhdpi/   
      ic_launcher.png  # App icon used on Nexus 6 device launcher

drawable 文件夹:

res/
   drawable-mdpi/
      ic_sunny.png
   drawable-hdpi/
      ic_sunny.png
   drawable-xhdpi/   
      ic_sunny.png
   drawable-xxhdpi/  # Fall back to these if xxxhdpi versions aren’t available
      ic_sunny.png 
   drawable-xxxhdpi/ # Higher resolution assets for Nexus 6
      ic_sunny.png

也就是说,mipmap 文件夹仅仅是用来存放 APP 的启动图标的,而 APP 中用到的其他资源图片仍需放到对应的 drawable 文件夹中。

参考链接:

  1. https://stackoverflow.com/questions/28065267/mipmap-vs-drawable-folders
  2. https://android-developers.googleblog.com/2014/10/getting-your-apps-ready-for-nexus-6-and.html
原文地址:https://www.cnblogs.com/jaxer/p/7204131.html