Android Screen sizes
Asked Answered
C

8

19

I need to know the screen sizes of android devices to support multiple screen sizes application.

Centrepiece answered 3/6, 2011 at 19:39 Comment(1)
by screen size do you need the physical size of the devices. ex 5 inch or 10 inch??Wilow
A
17

I don't think there's a comprehensive list of all existing screen sizes, since new devices are coming out all the time. Have you seen the page on Screen Sizes and Densities and the documentation on Supporting Multiple Screens?

Almonry answered 3/6, 2011 at 19:42 Comment(2)
I did read that and I did as explained but when I tested my application on android3 emulator my application appeared in a small part of the screen.But I won't it to fill the whole screen can I control that?Centrepiece
You need to use the <supports-screens> tag in the manifest to indicate what screen sizes your app supports. There's also an interaction with the targetSdkVersion attribute of the uses-sdk tag in the manifest. If you target too low an sdk level, devices (and emulators) running later levels might switch to compatibility mode for the application, which may restrict your application to a simulation of an HVGA screen.Almonry
J
18

Look at this table: http://developer.android.com/guide/practices/screens_support.html#testing

You can use the pie chart here to have an idea of relative screen size usage: http://developer.android.com/resources/dashboard/screens.html

For a list of screen sizes, resolutions and dpi values, take a look at: http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density

To calculate the real dpi value, check here: http://en.wikipedia.org/wiki/Pixel_density#Calculation_of_monitor_PPI

Jaella answered 3/6, 2011 at 19:43 Comment(0)
A
17

I don't think there's a comprehensive list of all existing screen sizes, since new devices are coming out all the time. Have you seen the page on Screen Sizes and Densities and the documentation on Supporting Multiple Screens?

Almonry answered 3/6, 2011 at 19:42 Comment(2)
I did read that and I did as explained but when I tested my application on android3 emulator my application appeared in a small part of the screen.But I won't it to fill the whole screen can I control that?Centrepiece
You need to use the <supports-screens> tag in the manifest to indicate what screen sizes your app supports. There's also an interaction with the targetSdkVersion attribute of the uses-sdk tag in the manifest. If you target too low an sdk level, devices (and emulators) running later levels might switch to compatibility mode for the application, which may restrict your application to a simulation of an HVGA screen.Almonry
K
16

Different screen sizes are as follows.

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

If you are plan to make an application which support for multiple devices, also you have to crate different layout directories for put different layouts.

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

If you are plan to add different sizes of images, put them in following folders accordingly. Android OS will automatically take the most suitable image out of them.

res/drawable-ldpi/my_icon.png        // bitmap for low density
res/drawable-mdpi/my_icon.png        // bitmap for medium density
res/drawable-hdpi/my_icon.png        // bitmap for high density
res/drawable-xhdpi/my_icon.png       // bitmap for extra high density

enter image description here

Kalgoorlie answered 9/7, 2013 at 11:40 Comment(3)
How to add images for , ldpi(240*320) and hdpi(480*640) in small screen folder !Fulfillment
You just have to put correct re-sized images in corresponding drawable folders. Android OS will automatically get the images from corresponding drawable folder, according to the screen sizes of the device.Kalgoorlie
thanks enadun , i think you want to say these types of folder . pages.citebite.com/p2t7t5p0b9qkiFulfillment
C
7

Android supports multitude of screen sizes. There is no list of specific screen sizes. Only approximate ranges. Read more at "Supporting Multiple Screens".

Cornstarch answered 3/6, 2011 at 19:42 Comment(6)
I've read that already but the whole point is that I want to have only one xml and I'll control the widgets' positions through my codeCentrepiece
You can't predict all possible variants of screen sizes. So you need to work in screen-size-agnostic ways. If you read reference article you'll see what approaches you can take to make your code working on all (or most) screens.Cornstarch
what I get from that article that i'll have to make different xmls for different screen sizes and toCentrepiece
@Cornstarch is correct, you can have a single xml layout that works for all screen sizes if you want, or you can provide a dpi-based layout for each of low, medium, or high dpi values. The key is to allow the views to resize themselves as needed and depending on dpi, as opposed to absolutely positioning and sizing them yourself.Balmoral
Ok but when i did as you've just said my application looked very bad on android 3 emulator that's why I'm trying to do what I'm doingCentrepiece
Actually It looks like the size specified for the application on and3 emulator is small that's why it looks small can I control that?Centrepiece
P
2

In terms of supporting different screen sizes I would start by taking a look at the Screen Support Reference, might be able to solve your problem better. To see a list of specific sizes take a look at Table 2

Pico answered 3/6, 2011 at 19:41 Comment(0)
J
1

Here it comes!

  • (240, 320)
  • (240, 400)
  • (320, 480)
  • (360, 640)
  • (480, 640)
  • (480, 800)
  • (480, 854)
  • (540, 960)
  • (600, 800)
  • (600, 1024)
  • (640, 960)
  • (720, 1280)
  • (768, 1280)
  • (768, 1024)
  • (800, 1280)
  • (1080, 1920)
  • (1200, 1920)
  • (1600, 2560)

fresh from http://en.wikipedia.org/wiki/Comparison_of_Android_devices 's html sources parsed with:

import re

s = ""

with open("sizes.html", "r") as src:
    s = src.read()

res = re.findall('([0-9]+)\s*[×xX]\s*([0-9]+)', s)

sizes = set()

for match in res:
    size_int = [int(match[0]), int(match[1])]
    size = (min(size_int), max(size_int))
    if size not in sizes:
        sizes.add(size)

sorted_sizes = list(sizes)
sorted_sizes.sort(key=lambda sz: sz[0])

for sz in sorted_sizes:
    print(sz)

(forgive my python)

Jerusalem answered 3/6, 2011 at 19:39 Comment(2)
Thank you for the link ! That's all I wanted to know .. how many pixels.Rhombencephalon
@Vincent you are welcome (also, anyone: the list above contains script output with couple (large) camera resolutions removed by hand).Jerusalem
U
0

Here's a little function to know the inch size of your device in case you need it to support multisize screen :

public double getInchSize()
{
    DisplayMetrics metrics = getResources().getDisplayMetrics();
    return Math.hypot(metrics.widthPixels/metrics.xdpi, metrics.heightPixels/metrics.ydpi)
}

Hope it can help

Unthinking answered 18/11, 2013 at 14:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.