Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Storing images in mipmap vs drawable folder

Tags:

android

As a general rule, when storing image resources for use in an Android project, should they be placed in the res/drawable or the res/mipmap folder?

Apologies for the simple question, I'm relatively new to Android development. The IDE I'm using is Android Studio 1.0.

like image 522
David Lim Avatar asked Mar 24 '16 09:03

David Lim


2 Answers

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.

like image 184
Lincoln White Avatar answered Oct 20 '22 05:10

Lincoln White


The graphic resources are stored in corresponding folders “drawable”. A store application icons are stored in the folders “mipmap”. To make the icon you have to make the files with the identical name which will be differ by resolution only and will be placed in the correspondent folders “mipmap”. Here are the the dimensions in pixels for each screen density:

LDPI  36×36.
MDPI 48×48.
TVDPI 64×64.
HDPI 72×72.
XHDPI 96×96.
XXHDPI 144×144.
XXXHDPI 192×192.

When the screen density is not important, I create a simple “drawable” folder and I store there all images. If the screen density is important it is possible to calculate the dimensions of the image, based on the ratio of the size of the base image to the appropriate screen ratio. For the base density is taken MDPI (48 × 48):

LDPI — MDPIx0.75.
HDPI — MDPIx1.5.
TVDPI — MDPIx1.33.
XHDPI — MDPIx2.
XXHDPI — MDPIx3.
XXXHDPI — MDPIx4.

At the time of publication in the convenience store (play.google.com), you will need also 512 × 512 icon and picture for advertisment of 1024 × 500.

In the manifest, do not forget to register R.mipmap.your_icon_name (default R.mipmap.ic_launcher) and the system will automatically select the icon under the screen density

like image 40
Viktor Avatar answered Oct 20 '22 07:10

Viktor