Mipmaps Vs. Drawable Folders

Mipmaps vs. drawable folders

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.

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.

When referencing the mipmap- folders ensure you are using the following reference:

android:icon="@mipmap/ic_launcher"

The reason they use a different density is that some launchers actually display the icons larger than they were intended. Because of this, they use the next size up.

Android - Storing images in mipmap vs drawable folder

My rule is that if an image will have noticeable changes in quality when they are scaled up or down depending on the android device should be stored in mipmap folders. Examples of such images would be icons, slider bar scrubbers or custom google map markers. Images that don't get affected by changes in scale can be put in the drawable res folder.

What to use mipmap or drawable

Using mipmaps for your launcher icon is described as best practice by the Android team. The advantage you get is that you can keep resources in the mipmap folders for all device densities and then strip out other resources from the drawable folders that are not relevant to the specific users device density.

For example a user has a device that is classified as xxhdpi. The drawable resources in your apk for all other densities, such as xxxhdpi, are not required and can be stripped out.

reference

mipmap and drawable folders

add all .png images to

1. drawable-hdpi
2. drawable-mdpi
3. drawable-xhdpi
4. drawable-xxhdpi

it automatically suits too all devices where it is run!

Confusion about drawable and mipmap in Android Studio from older example in book

Different uses of mipmap and drawable folder

I finally understood the difference uses between mipmap and the drawable folder by looking at the official google documentations of the resource folder (res/).

They say when to use mipmap:

Drawable files for different launcher icon densities. For more information on managing launcher icons with mipmap/ folders, see Managing Projects Overview.

And when to put something in your drawable folder:

Bitmap files (.png, .9.png, .jpg, .gif) or XML files that are compiled
into the following drawable resource subtypes:

Bitmap files

  • List item
  • Nine-Patches (re-sizable bitmaps)
  • State lists Shapes
    Animation
  • drawables
  • Other drawables
  • See Drawable Resources


Qualifiers appended to folder-names have special meaning in android

Also noticeable is there is for the launcher icon by default multiple folders with different resolutions but for the drawable folder there is not. Android OS looks for these folder with special names, called qualifiers. For instance for the drawable folders there are these qualifiers and more:

  • ldpi
  • hdpi
  • xdpi

These qualifiers are appended to these resource folder names like drawable-ldpi, drawable-hdpi and drawable-xdpi so the android operating system will look into these folders to find the best resolution of the files in the folders.



To answer the questions from above:

  1. People make the mistake of using the term icon when they actually mean launcher icon. The launcher icon should be placed in the mipmap and is there by default.
  2. Nothing besides the launcher icon should be placed in the mipmap
  3. Android provides configuration qualifiers to make it easier to change the app based on specific device settings like screen resolution and screen orientation. It makes a lot of sense to include different size versions since downscaling and upscaling can then be done much more accurate to fit all kind of screen sizes.

Hope this helps anyone. I found this hard to find.

Drawable folders replaced with mipmap folders in Xamarin.Android project in Visual Studio 2017?

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.

According to the this article:

Why use mipmaps for your launcher icons?

Using mipmaps for your launcher icon is described as best practice by the Android team. The advantage you get is that you can keep resources in the mipmap folders for all device densities and then strip out other resources from the drawable folders that are not relevant to the specific users device density.

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.

When referencing the mipmap- folders ensure you are using the following reference:

Icon = "@mipmap/icon"


Related Topics



Leave a reply



Submit