开发者

Android Screen sizes

开发者 https://www.devze.com 2023-03-11 09:59 出处:网络
I ne开发者_C百科ed to know the screen sizes of android devices to support multiple screen sizes application.Look at this table: http://developer.android.com/guide/practices/screens_support.html#testin

I ne开发者_C百科ed to know the screen sizes of android devices to support multiple screen sizes application.


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


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?


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

Android Screen sizes


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


LDPI MDPI HDPI

Please see this: http://developer.android.com/guide/practices/screens_support.html

then this: http://developer.android.com/resources/dashboard/screens.html

then this: http://developer.android.com/guide/topics/resources/providing-resources.html


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


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)


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号