Android Screen Sizes in Pixels for Ldpi, Mdpi, Hpdi

android splash screen sizes for ldpi,mdpi, hdpi, xhdpi displays ? - eg : 1024X768 pixels for ldpi

There can be any number of different screen sizes due to Android having no set standard size so as a guide you can use the minimum screen sizes, which are provided by Google.

According to Google's statistics the majority of ldpi displays are small screens and the majority of mdpi, hdpi, xhdpi and xxhdpi displays are normal sized screens.

  • xlarge screens are at least 960dp x 720dp
  • large screens are at least 640dp x 480dp
  • normal screens are at least 470dp x 320dp
  • small screens are at least 426dp x 320dp

You can view the statistics on the relative sizes of devices on Google's dashboard which is available here.

More information on multiple screens can be found here.

9 Patch image

The best solution is to create a nine-patch image so that the image's border can stretch to fit the size of the screen without affecting the static area of the image.

http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch

Android. ldpi, mdpi, hdpi clarification

Your images should be at least the size which can be easily viewable, or even clickable for the user on his/her devices.

The guidelines are for specific images, like launcher icons, or menu items, and not necessarily for any images you use in your app. For these kind of images, you are the best judge of specifying the image sizes and resolutions.

You could well have those images as only mdpi, and supply an hdpi version, so that it atleast has a higher resolution image for hdpi and xdpi devices.

Screen sizes of android

Hdpi, xhdpi, etc. are not screen sizes, they are screen pixel densities. If you want to adjust your image according to screen sizes, you should use small/medium/large/xlarge. (And combine it with hdpi/xhdpi/... for sharp and accurate results :))

You can always use some most common resolutions, like HD, fullHD, 800x480 etc. But you have a bigger problem - differences in aspect ratio. Newer devices tend to use 16:9 aspect ratio, but older models with 800x480 screens are different, so you should consider some padding/cropping to ensure image is not stretched, and just then worry about resolution.

Good luck with that :)

Edit:
You can create your own resource folders, you can even use multiple modifiers.

http://developer.android.com/guide/topics/resources/localization.html

Just create folder 'drawable-small-hdpi' or whatever and it will work :)

You can also use other modifiers, f.e. drawable-de-small should load specified drawables only on "german speaking" devices with small displays.

About image sizes: documentation(the article you are linking) states:

  • xlarge screens are at least 960dp x 720dp

  • large screens are at least 640dp x 480dp

  • normal screens are at least 470dp x 320dp

  • small screens are at least 426dp x 320dp

So you if you want good compatibility, you go like this(in pixels):

  • small-mdpi = 426x320

  • small-hdpi = 639x480

  • small-xhdpi = 852x640

  • normal-mdpi = 470x320

  • normal-hdpi = ....

    ......

  • xlarge-hpdi = ....

  • xlarge-xhdpi = 1920x1440

Just remember that 1 dp in mdpi is 1px, in hdpi it is 1.5px, xhdpi is 2px and xxhdpi is 3px.

In practice, you really don't see many xxhdpi devices with small or even normal screen, so you can omit some extremes. If you don't care about some stretching here and there on smaller phones, you can even completely ommit the small option and rely on the match_parent attribute to fit the image.

But you still have to design carefully because these are just minimum sizes.

Also consider phones with hardware buttons and software buttons - with hardware buttons and same screen, you get more space for your app, so, again, different aspect ratio!

From my experience, I would recommend splitting your splash screen in elements that must at all times remail "good looking", like logo. And then define some background that can stretch a bit here and there. So that you can set the background to match_parent and always cover whole screen and "logos" to wrap_content or fixed size in dp so their aspect ratio won't change and pixel size can be easily calculated.

Pixel size of images

Sorry, You cannot have a Default size...

If you are developing a Mobile app, then you should detect the User's screen size and use an appropriate dimension of the picture there....

Have at least three different variations of the same picture for different screen sizes..

Android Has an inbuilt way of doing this Have a look at this : Supporting Different Screen Sizes

Understanding Density independence

Actually, the rectangle is exactly 100px wide on both devices. What you actually measured was the physical width of the rectangle.

Confused? Let me explain:

The rectangle gets drawn as exactly 100px wide on both devices. They have the same screen resolution, but one has a lower density, measured in dpi (= dots per inch) or sometimes ppi (= pixels per inch). (In Android, as you might already know mdpi means medium dpi (~160dpi) and hdpi means high dpi (~240dpi))
Now, dpi is nothing else than the physical size of one pixel, instead of saying there are 160 pixels/inch you could also say one pixel is 0.something inches big.
That means the physical size of the rect you draw is the width of the rectsize of one pixel. Also, the width of the screen is the resolution in pxsize of one pixel. (Actually, the screen of the mdpi device should be displayed smaller than the hpdi device's one)

What happens is that the emulator takes your monitors dpi into account and scales the device accordingly. For your mdpi device it just works out that one device pixel is translated to one monitor pixel, for the hdpi device one device pixel is equal to 0.88 monitor pixels.

In other words, the if these were real phones, the mdpi would have a bigger screen allthough both have the same resolution. The rect would be 100px wide on both but since a pixel on the mdpi phone is bigger the rect would be physically bigger. The pixels on your monitor thus actually are the physical size of the rect.

If you still have no idea what i'm talking about, read this article about supporting different screens in android.



Related Topics



Leave a reply



Submit