Size Issues in Android design

Source: Internet
Author: User
Tags benchmark

Android divides the screen size into four types: small, normal, large, xlarge;
The screen density is divided into: low (LDPI), Medium (MDPI), High (hdpi), Extra High (xhdpi), and the relationship between each screen density is as follows:

Density name reference value for density (DPI) Relationship the corresponding screen resolution
xxxhdpi 640dpi
xxhdpi 480dpi
xhdpi 320dpi 2.0
hdpi 240dpi 1.5 800*480
mdpi 160dpi 1.0 (Benchmark) 480*320
ldpi 120dpi 0.75 320*240

DPI (dot per inch): The number of pixels per inch, 1 inches = 2.54 centimeters, usually said 4.3 inches, 4.5 inches is actually the length of the screen diagonal.

DP (density independent pixel): independent density pixels, using DP as the unit to set the control, regardless of the screen or the size of the DPI, its display is consistent, if you use PX, you will see inconsistent results. For example, a 160px-length segment with a density of 160dpi and a width of 1 inches fills the entire screen, while on a screen with a density of 320dpi and a width of 1 inches, only half of the screen is filled, that is, for two screens with the same physical size but different dpi, The difference in the display effect can be very large.

The relationship between pixel, DP, and DPI is as follows:

PX = DP * (dpi/160)

principle 1: When transduction the Android interface, 160DPI is generally used as a benchmark . Because the 160DIP as a benchmark, as long as the transduction of the length and width of the number of pixels is a multiple of 4, then xhdpi the figure on the length of the width of the number of pixels can be multiplied by 2,hdpi under the 1.5,ldpi multiplied by 0.75, the result of the resulting length and width of the number of pixels is an integer. If 240dpi is used as the benchmark, then the number of pixels in the 240-cut graph is a multiple of 3, and the corresponding number of pixels is multiplied by 1.333333,mdpi under xhdpi and multiplied by 0.66666,ldpi, which gives a non-shaping pixel count.

QVGA, the screen density of WQVGA is: 120
The screen density of the HVGA is: 160
The screen density of the WVGA is: 240
Where ldpi resources are not required, when providing hdpi resources, the system automatically shrinks the HDPI resources by half to fit the ldpi screen

Note: Screen density and screen resolution are different concepts, with screen resolution and size, you can calculate the screen density , for example, the resolution is 320*480, the screen size is 3.2 inches (diagonal length), the screen density is:

Note: Dip is DP

SP (scale independent pixel): scaling independent pixels, similar to DP, the only difference is that the unit is affected by the system font settings and is usually used in fonts. Common font sizes specified in the Android specification:

Displaymetrics class

Displaymetrics is a class that describes screen-related parameters and accesses the Displaymetrics method:

DisplayMetrics metrics = new DisplayMetrics();getWindowManager().getDefaultDisplay.getMetrics(metrics);

You can then access the individual constants, fields, and methods in the metrics variable.

  • Density: Screen density
  • DENSITYDPI: Screen density, in dpi
  • Heightpixels: screen height, in pixels
  • Widthpixels: Screen width, in pixels
  • XDPI: Screen density in X-direction of the screen
  • YDPI: Screen density in the Y-direction of the screen
Market data

Top-ranked screen resolutions:

resolution percentage screen Density
1280 * 720 29.2% 267 ~ 293 (hdpi, xhdpi)
800 * 480 18.5% 233 ~ 266 (HDPI)
854 * 480 13.8% 195 ~ 217 (MDPI, hdpi)
1920 * 1080 10.6% 367 ~ (xhdpi)
960 * 540 10% ~ 244 (HDPI)
480 * 320 4.1%
1184 * 720 3%

Data Source: Http://www.umindex.com/devices/android_resolutions

RELATED LINKS
  1. Https://developer.android.com/design/style/devices-displays.html
  2. Http://developer.android.com/training/basics/supporting-devices/screens.html
  3. Http://www.25xt.com/allcode/4269.html

Size Issues in Android design

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.