user3051755
user3051755

Reputation: 1557

Image resolution for mdpi, hdpi, xhdpi and xxhdpi

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?

Upvotes: 106

Views: 269104

Answers (7)

Ashfaque
Ashfaque

Reputation: 332

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

Upvotes: 0

Saeed
Saeed

Reputation: 3520

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

Upvotes: 12

ldev
ldev

Reputation: 155

Relative sizes for bitmaps at different density sizes

Check the image above I hope it will help someone.

Link to the whole article itself

Upvotes: 7

Tin Luu
Tin Luu

Reputation: 1687

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

Upvotes: 4

Rahul Agrawal
Rahul Agrawal

Reputation: 1189

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/

Upvotes: 117

Manuel Ramírez
Manuel Ramírez

Reputation: 2415

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.

Upvotes: 206

change_is_necessity
change_is_necessity

Reputation: 707

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.

Upvotes: 1

Related Questions