0

I am directly adding images in drawable folders and it is coming fine with ImageView tag android:src="@drawable/image_name" but I wonder what to do with the other drawable folders as shown below.

enter image description here

Do I need to add same image in all drawable folders or my way of adding images in drawable folders is wrong?

Please help me!

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Amit Gupta
  • 2,771
  • 2
  • 17
  • 31

3 Answers3

1

The image is same, but the size should be different for each folders. If you add the image only in drawable folder, same image will be loaded for all screen resolutions. So for eg: if the image size is small, this may result in bad image quality.

You can find a similar question here

I use Android studio plugin Android Drawable Importer

Adolf Dsilva
  • 13,092
  • 8
  • 34
  • 45
  • so it means we have to add images in all drawable folders with different sizes – Amit Gupta Nov 16 '17 at 09:37
  • Well.. Theoretically Yes... But practically you can skip ldpi as very few devices now have this resolution and I usually skip HDPI as the android device can down/up scale from its closest resolution. And if the image size is really big (for eg background images), I also skip the xxxdpi... – Adolf Dsilva Nov 16 '17 at 09:42
1

All these drawable folders represent different android phone densities. The best folder to put your images is drawable-xxhdpi as android automatically downscale or upscale the images depending on your devices density and most phones these days are on xxhdpi density.

If you put a image in drawable folder only there are chances that image may get distorted(as it upscales) in xxxhdpi density.

If you are putting images in xxhdpi ,make sure you create your images acc. to xxhdpi resolution.

If you don't feel the image is looking right in some phones than check the density of that phone and put an image in that specific density folder acc. to it's size(reduced or increased).

0

Just put it in the drawable folder, no need to put it in other drawable-... folders because those folders and contents inside are created automatically by android studio.

Nikko Dela Cruz
  • 42
  • 2
  • 10