1. mipmap technology
Android has added mipmap technology in API level 17, and supports mipmap technology for rendering bitmap images to improve the speed and quality of rendering.
By Bitmap method public final void setHasMipMap (Boolean hasMipMap)
, API can make the system renderer try to turn on Bitmap mipmap
technology. However, this method can only be used to suggest that the system turn this function on, and it is up to the system to decide whether it is actually turned on or not.
The difference between mipmap and drawable below the res directory is the difference between whether this setting is enabled or not. Images in the mipmap directory setHasMipMap is true and drawable setHasMipMap is false by default.
2. Why use mipmap folder?
Different home screen launcher apps on different devices show app launcher icons at various resolutions. When app resource optimization techniques remove resources for unused screen densities, launcher icons can wind up looking fuzzy because the launcher app has to upscale a lower-resolution icon for display. To avoid these display issues, apps should use the mipmap/ resource folders for launcher icons. The Android system preserves these resources regardless of density stripping, and ensures that launcher apps can pick icons with the best resolution for display.
3.use mipmap folder
Make sure launcher apps show a high-resolution icon for your app by moving all densities of your launcher icons to density-specific res/mipmap/
folders (for example res/mipmap-mdpi/
and res/mipmap-xxxhdpi/
). The mipmap/folders
replace the drawable/ folders for launcher icons. For xxhpdi
launcher icons, be sure to add the higher resolution xxxhdpi
versions of the icons to enhance the visual experience of the icons on higher resolution devices.
Note:
1.Even if you build a single APK for all devices, it is still best practice to move your launcher icons to the mipmap/
folders.
2.The mipmap is just for the launcher icon, so the rest of the resource images should still be in our drawable directory.