Representation of the "Android" screen size

Source: Internet
Author: User

1. Units

-PX (pixel): normal pixel description, one color point in the bitmap (Rgba or YUV)

-Dip (device independent pixels): devices independent pixels.

-DP: Same as dip.

-PT (point): standard length unit. 1pt = 1.0/72 (in).

-SP (scaled pixel): Used for font display.

-In (inch): inches

-mm (millimeter): mm

2. Screen density

Screen type width (pixels) Height (pixels) Dimensions (inches) Screen density
QVGA 240 320 2.6-3.0 Low
WQVGA 240 400 3.2-3.5 Low
Fwqvga 240 432 3.5-3.8 Low
HVGA 320 480 3.0-3.5 Medium
WVGA 480 800 3.3-4.0 High
FWVGA 480 854 3.5-4.0 High
WVGA 480 800 4.8-5.5 Medium
FWVGA 480 854 5.0-5.8 Medium

Default screen density: low = 120; Medium = 160; High = 240

3. Conversion of screen units

/frameworks/base/core/java/android/util/typedvalue.java

303/**304 * Converts an unpacked complex data value holding a dimension to it final floating305 * point value. The Parameters <var>unit</var> and <var>value</var>306 * is as in {@link#TYPE_DIMENSION}.307 *308 *@param UnitThe unit to convert from.309 *@param valueThe value to apply the unit to.310 *@param MetricsCurrent display metrics to use in the conversion--311 * Supplies display density and scaling informati on.312 *313 *@returnThe complex floating point value multiplied by the appropriate314 * metrics depending on its unit.315 */316 Public Static floatApplydimension (intUnitfloatvalue,317 Displaymetrics Metrics) 318 {319Switch(unit) {320 Casecomplex_unit_px:321returnvalue;322 Casecomplex_unit_dip:323returnValue * metrics.density;324 Casecomplex_unit_sp:325returnValue * metrics.scaleddensity;326 Casecomplex_unit_pt:327returnValue * metrics.xdpi * (1.0f/); 328 case  complex_unit_in:329 return value * metrics.xdpi;330 C        ASE complex_unit_mm:331 return value * metrics.xdpi * (1.0f/25.4f); 332}333 return 0;334}

/frameworks/base/core/java/android/util/displaymetrics.java
Public Static Final int Density_low = + ;
 Public Static Final int ;
 Public Static Final int 213;
 Public Static Final int ;
 Public Static Final int ;
 Public Static Final int ;
 Public Static Final int 480;
 Public Static Final int 560;
 Public Static Final int 640;
 Public Static Final int Density_default = Density_medium;
 Public Static Final float 1.0f/density_default;

Public Static int Density_device = Getdevicedensity ();
Density =  density_device/(float) Density_default;

PX = dip * Density = dip * density_device/density_default.

Representation of the "Android" screen size

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.