Android Screen sizes

半城伤御伤魂 提交于 2019-11-27 12:26:20

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?

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

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 supports multitude of screen sizes. There is no list of specific screen sizes. Only approximate ranges. Read more at "Supporting Multiple Screens".

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

mlvljr

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!