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)