| ppi | Pixel Per Inch | 像素密度 | 物理参数 | 538 |
|---|---|---|---|---|
| dpi | Dot Per Inch | 像素密度 | 软件指定的,可能人为修改,不同ppi的手机譬如430、440、450,系统能指定dpi都为480 | 640 |
| dp/dip | Density-independent Pixels | 抽象单位 | 1 dp = 1 pixel, — in 160 dpi screen | 1 dp = 4 pixels |
| density | density = dpi /160 | 每 dp 占当前设备屏幕多少像素 | 4 | |
| sp | scale-independent pixels | specifying font sizes, so they will be adjusted for both the screen density and user’s preference. | ||
| mate 20 pro |
inch, 1 inch = 2.54 centimeters, 就是和键盘的shift的按键差不多长度,但是稍微短一点 ppi等于或者约等于dpi
+----------------+----------------+---------------+-------------------------------+| Density Bucket | Screen Density | Physical Size | Pixel Size |+----------------+----------------+---------------+-------------------------------+| ldpi | 120 dpi | 0.5 x 0.5 in | 0.5 in * 120 dpi = 60x60 px |+----------------+----------------+---------------+-------------------------------+| mdpi | 160 dpi | 0.5 x 0.5 in | 0.5 in * 160 dpi = 80x80 px |+----------------+----------------+---------------+-------------------------------+| hdpi | 240 dpi | 0.5 x 0.5 in | 0.5 in * 240 dpi = 120x120 px |+----------------+----------------+---------------+-------------------------------+| xhdpi | 320 dpi | 0.5 x 0.5 in | 0.5 in * 320 dpi = 160x160 px |+----------------+----------------+---------------+-------------------------------+| xxhdpi | 480 dpi | 0.5 x 0.5 in | 0.5 in * 480 dpi = 240x240 px |+----------------+----------------+---------------+-------------------------------+| xxxhdpi | 640 dpi | 0.5 x 0.5 in | 0.5 in * 640 dpi = 320x320 px |+----------------+----------------+---------------+-------------------------------+
+---------+-------------+---------------+-------------+--------------------+| Unit | Description | Units Per | Density | Same Physical Size || | | Physical Inch | Independent | On Every Screen |+---------+-------------+---------------+-------------+--------------------+| px | Pixels | Varies | No | No |+---------+-------------+---------------+-------------+--------------------+| in | Inches | 1 | Yes | Yes |+---------+-------------+---------------+-------------+--------------------+| mm | Millimeters | 25.4 | Yes | Yes |+---------+-------------+---------------+-------------+--------------------+| pt | Points | 72 | Yes | Yes |+---------+-------------+---------------+-------------+--------------------+| dp | Density | ~160 | Yes | No || | Independent | | | || | Pixels | | | |+---------+-------------+---------------+-------------+--------------------+| sp | Scale | ~160 | Yes | No || | Independent | | | || | Pixels | | | |+---------+-------------+---------------+-------------+--------------------+
