Android Adaptation Program summary (i)

Source: Internet
Author: User

relevant units of measurement introduction:
PX: Is the pixel point of the screen, the same effect is displayed on different devices.
In: inches (1 inches equals 2.54cm)
MM: MM
PT: lbs, 1/72 inch
Dp:device independent pixels (device independent pixels), different devices have different display effects, this and the device
Hardware-related. Based on the density abstract unit, if a 160dpi screen, 1dp=1px. (160dpi means 1 inches
There are 160 pixel points)
Dip: Equivalent to DP, so we use the same DP and dip effect in XML.
sp:scaled pixels, similar to DP, but also scaled based on the user's font size preference.
Dpi:dots per inch, pixels in inches.
Density: Usually this is not the screen density we mentioned on the Android platform, but the pixel dots per inch with 160dpi
(a standard set by Google).
The value of DENSITYDPI indicates how many pixels per inch, in DPI.

Dip vs px Relationship:
QVGA DENSITYDPI = 120Density = 0.751DP = 0.75pxldpi
HVGA densitydpi = 160Density = 11DP = 1pxmdpi
Vga densitydpi = 160Density = 11DP = 1pxmdpi
WVGA DENSITYDPI = 240Density = 1.51DP = 1.5pxhdpi
WQVGA DENSITYDPI = 320Density = 21DP = 2pxxhdpi

Resource folder matching:
Android uses density to match resources by default:
When the screen density = 2 o'clock, use the resources under the DRAWABLE-XHDPI folder
When the screen density = 1.5, use the resources under the DRAWBLE-HDPI folder
When the screen density = 1 o'clock, use the resources under the DRAWBLE-MDPI folder
When the screen density = 0.75, use the resources under the Drawable-ldpi folder.

(Although the screen pixel density of Android devices follows the 0.75:1.0:1.5:2.0 ratio, some of the devices on the market are not fully

In accordance with the above four cases, there may be between 2 people: such as 1.33, you can use the resources under the Drawable-tvdpi folder. )


Android Adaptation Program summary (i)

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.