Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android screen sizes in Pixels for ldpi, mdpi, hpdi?

I've read 10 articles yet still cant find any relation between ldpi, mdpi, hdpi and the actual dimensions in pixels!? Can anybody give a straightforward answer please(if there is one!)

I'm basically trying to put together a splash screen that needs to work on multiple devices without stretching - but i'm struggling as everything I try is either squashed or stretched!?

Cheers Paul

like image 594
Dancer Avatar asked Nov 17 '11 14:11

Dancer


People also ask

What is small screen size in Android?

The “small” screen size is really an artifact of the original Android devices having 320x480 screens. 240x320 screens have a shorter aspect ratio, and applications that don't take this into account can break on them.


2 Answers

The ldpi, mdpi and hdpi refer to screen density, which means how much pixels can fit into a single inch.

the ratio in pixels between them is:

  • ldpi = 1:0.75
  • mdpi = 1:1
  • hdpi = 1:1.5
  • xhdpi = 1:2
  • xxhdpi = 1:3
  • xxxhdpi = 1:4

so lets take an image with about the size of 100X100:

  • for mdpi it should be 100X100
  • for ldpi it should be 75X75
  • for hdpi it should be 150X150
  • for xhdpi it should be 200X200
  • for xxhdpi it should be 300X300
  • for xxxhdpi it should be 400X400

this way, for screens with the same size but different DPI, all the images seem the same size on screen.

Also you have multiple screen size types small, normal, large, xlarge and each one of them can be ldpi, mdpi, hdpi, xhdpi, xxhdpi (Nexus 10) or xxxhdpi.

You can try to create a splash screen image that fit to each and every screen type which gives you 4*5 = 20 different images (it seems to much for me).

For now only the Nexus 10 is at the xxhdpi category.

like image 108
Eitan Avatar answered Sep 21 '22 10:09

Eitan


Install ImageMagick and use this shell script to generate your splash and icon files for multiple devices - iOS, Android, Bada and Windows Phone. You can use cygwin/gitbash if you are on Windows

I just did and I'm pretty happy with it :-)

The screen sizes are inside the script and are -

480x800 - screen-hdpi-portrait.png 320x200 - screen-ldpi-landscape.png 720x1280 - screen-xhdpi-portrait.png 320x480 - screen-mdpi-portrait.png 480x320 - screen-mdpi-landscape.png 200x320 - screen-ldpi-portrait.png 800x480 - screen-hdpi-landscape.png 
like image 38
Peter Avatar answered Sep 23 '22 10:09

Peter