99

I have a background for my app in resolutions 720x1280 pixels, 1080x1920 pixels and 1440x2560 pixels.

In which folders (mdpi, hdpi, xhdpi and xxhdpi) should I put each background?

user3051755
  • 1,497
  • 2
  • 16
  • 27

7 Answers7

192

Please read the Android Documentation regarding screen sizes.

From a base image size, there is a 3:4:6:8:12:16 scaling ratio in drawable size by DPI.

LDPI - 0.75x
MDPI - Original size // means 1.0x here 
HDPI - 1.5x
XHDPI - 2.0x
XXHDPI - 3x
XXXHDPI - 4.0x

For example, 100x100px image on a MDPI will be the same size of a 200x200px on a XHDPI screen.

Rajesh Satvara
  • 3,842
  • 2
  • 30
  • 50
Manuel Ramírez
  • 2,275
  • 1
  • 13
  • 15
  • so if I get this straight, the DP is calculated dividing a 160 DPI screen (which is the mdpi base) and the screen DPI, which gives the factors of 0.75, 1,1.5, 2, 3 and 4 and those are used to scale the resolution of the desired image right? Sorry, this is a bit confusing yet – Juan Carlos Alpizar Chinchilla Mar 01 '16 at 22:58
  • Is this also true for text size? – kgandroid Jan 22 '19 at 08:46
  • Somewhat I'm not agree with your answer because if your original image size is 1500x1500 then XXXHDPI should be 6000x6000 and it will cause out of memory error, can you elaborate more on it. what is a standard size for the dpi so we can follow this one. – Kishan Donga May 06 '20 at 14:12
113

Require Screen sizes for splash :

LDPI: Portrait: 200 X 320px
MDPI: Portrait: 320 X 480px
HDPI: Portrait: 480 X 800px
XHDPI: Portrait: 720 X 1280px
XXHDPI: Portrait: 960 X 1600px
XXXHDPI: Portrait: 1440 x 2560px

Require icon Sizes for App :

http://iconhandbook.co.uk/reference/chart/android/

Rytis
  • 1,447
  • 1
  • 19
  • 38
Rahul Agrawal
  • 1,149
  • 1
  • 7
  • 2
  • 2
    Why is xxxhdpi x size larger than y? Why 320*4 equals to 1440 and 320*2 equals to 720? Please, edit. – CoolMind Oct 30 '16 at 17:34
  • 1
    Thanks. For all those ppl who want to know the max resolution you can use for the screen size refer this. – sanjeev Mar 21 '18 at 04:54
10

DP size of any device is (actual resolution / density conversion factor).

Density conversion factor for density buckets are as follows:

ldpi: 0.75
mdpi: 1.0 (base density)
hdpi: 1.5
xhdpi: 2.0
xxhdpi: 3.0
xxxhdpi: 4.0

Examples of resolution/density conversion to DP:

  • ldpi device of 240 X 320 px will be of 320 X 426.66 DP. 240 / 0.75 = 320 dp 320 / 0.75 = 426.66 dp

  • xxhdpi device of 1080 x 1920 pixels (Samsung S4, S5) will be of 360 X 640 dp. 1080 / 3 = 360 dp 1920 / 3 = 640 dp

This image show more:

Density

Saeed
  • 3,294
  • 5
  • 35
  • 52
5

Relative sizes for bitmaps at different density sizes

Check the image above I hope it will help someone.

Link to the whole article itself

ldev
  • 103
  • 1
  • 6
3

Your inputs lack one important information of device dimension. Suppose now popular phone is 6 inch(the diagonal of the display), you will have following results

enter image description here

DPI: Dots per inch - number of dots(pixels) per segment(line) of 1 inch. DPI=Diagonal/Device size

Scaling Ratio= Real DPI/160. 160 is basic density (MHDPI)

DP: (Density-independent Pixel)=1/160 inch, think of it as a measurement unit

Tin Luu
  • 1,557
  • 16
  • 22
1

in order to know the phone resolution simply create a image with label mdpi, hdpi, xhdpi and xxhdpi. put these images in respective folder like mdpi, hdpi, xhdpi and xxhdpi. create a image view in layout and load this image. the phone will load the respective image from a specific folder. by this you will get the phone resolution or *dpi it is using.

  • 2
    ... or do the same with string resources, which might be a bit easier to handle. Good idea though as you can add more info and compose a handy utility app that shows you some device properties. –  Apr 04 '18 at 11:15
0

When designing images for different screen densities in Android, it's important to consider the following resolutions for the most common screen density buckets:

1. MDPI (Medium Dots per Inch):

  • Resolution: 160 DPI (Dots per Inch)
  • Image resolution: 1x baseline (mdpi)
  • Example image size: 48x48 pixels

2. HDPI (High Dots per Inch):

  • Resolution: 240 DPI (Dots per Inch)
  • Image resolution: 1.5x baseline (hdpi)
  • Example image size: 72x72 pixels

3. XHDPI (Extra High Dots per Inch):

  • Resolution: 320 DPI (Dots per Inch)
  • Image resolution: 2x baseline (xhdpi)
  • Example image size: 96x96 pixels

4. XXHDPI (Extra Extra High Dots per Inch):

  • Resolution: 480 DPI (Dots per Inch)
  • Image resolution: 3x baseline (xxhdpi)
  • Example image size: 144x144 pixels
Ashfaque
  • 179
  • 4