2

I see a lot of post on this topic, however I haven't seen an explanation on what image size to take as a reference, let me explain.

I want to add a background image and make it suitable for each phone screen size so from mdpi to xxhdpi (if I'm not talking nonsense)

What size should my base image be?

I used a 600x1200 image and a 1080x1920 then converts using this site

https://romannurik.github.io/AndroidAssetStudio/

Unfortunately I noticed that on my two phones the image was distorted, I'm starting to think my base image size was wrong

So my question

What image size should I take to then create multiple densities ?

Sorry if it's redundant !!!

I'm starting to learn how to adapt and it's not that easy

  • Does this answer your question? [Screen densities and images dimensions](https://stackoverflow.com/questions/44489892/screen-densities-and-images-dimensions) – Jennifer Kiesel Apr 01 '21 at 12:51

2 Answers2

0

I think the site is for (mainly launcher) icons.

If your target device's display has 1080x1920 size with xxhdpi (3x) density, just put an image of the size in the res/drawables/xxhdpi folder. No other densities are needed to be prepared. They will be re-scaled from the xxhdpi image if needed.

If you still want to prepare for those densities, first prepare the highest density. If you want to use xxxhdpi (4x), you should start with xxxhdpi sized image. Then scale it down to xxhdpi (3x), xhdpi (2x), hdpi (1.5x) and mdpi (1x).

  1. xxxhdpi (4x): 100%
  2. xxhdpi (3x): 75%
  3. xhdpi (2x): 50%
  4. hdpi (1.5x): 37.5%
  5. mdpi (1x): 25%

Support different pixel densities: Provide alternative bitmaps

hata
  • 11,633
  • 6
  • 46
  • 69
0

If you want to create a background picture, your reference size is mdpi with 320x480px. You can then calculate the size according to the factor

  • hdpi: 1.5 (480x720)
  • xhdpi: 2.0 (640x960)
  • xxhdpi: 3.0 (960x1440)
  • xxxhdpi: 4.0 (1280x1920)

Note however, that nowadays devices have all kinds of other aspect ratios (mostly longer). So you have to design your background in a way, that the outer area does not contain important content. Then use ScaleType CENTER_CROP and your image should not be distorted (https://developer.android.com/reference/android/widget/ImageView.ScaleType)

Benjamin Mesing
  • 4,075
  • 1
  • 18
  • 22
  • I created a xxxhdpi image (1280x1920) it works well I tried on several devices I will now try with several online emulators to see how it goes, I think to add in case add the other densities – Asmdl Alzldld Apr 01 '21 at 23:46