Units in Android
Unit 1, px pixel (pixels) VGA 480*640 pixel (Video Graphics Array) QVGA 240*320 pixel (Quarter VGA) HVGA 320*480 pixel (Half-size VGA) WVGA 800*480 pixels (Wide VGA) WQVGA 400*240 pixels (Wide Quarter VGA) XGA 1024*480 pixels (Extended Graphics Array) 2, dp or dip device independent pixel (device independent pixels) Description: the ratio of dp to pixel density is related to the ratio of dp * density = px, so it has the effect of automatically adapting to the screen. Common density ratio: the density ratio of 240*320 is 0.75eg: 160dp * 0.75 = 120px320*480. The density ratio is: 1.0160dp * 1.0 = 160px316* 800: 1.5160dp * 1.5 = 240px3, sp proportional pixel (scaled pixels-best for text size) Description: used to handle the font size, you can automatically adapt to the user's system font [note] in order to adapt to different resolutions, we recommend that you use dp for different pixel density. in addition to the preceding three display units, we also recommend that you use sp for text: in (inches) inch mm (millimeters) millimeter pt (points) Point, 1/72 inch