In Android Development, screen densities and screen logic sizes are often used to fit the screens, and a list of screen parameters for common phones is listed here:
pixel density level |
pixel density |
logical pixel density |
screen pixels |
screen Size (inch) |
wide logic size (DP) |
true pixel density |
Device Model |
ldpi-0.75 |
120 |
120 |
240*320 |
2.7 |
W320dp |
140.55 |
|
Mdpi-1 |
160 |
160 |
320*480 |
3.2 |
W320dp |
180.27 |
|
hdpi-1.5 |
240 |
240 |
480*800 |
3.4 |
W320dp |
274.39 |
|
Xhdpi-2 |
320 |
320 |
720*1280 |
4.65 |
W360dp |
315.6 |
|
Xhdpi-2 |
320 |
320 |
768*1280 |
4.65 |
W384dp |
321 |
Nexus4 |
Xxhdpi-3 |
480 |
480 |
1080*1920 |
4.95 |
W360dp |
445 |
Nexus5 |
Xxhdpi-3 |
480 |
420 |
1080*1920 |
5.2 |
W411dp |
423 |
nexus5x |
Xxxdpi-4 |
640 |
560 |
1440*2560 |
5.96 |
W411dp |
493 |
nexus6/6p |
- Pixel density level: is the ROM manufacturer set the value, generally take the actual screen density closest to the screen density level, but can also be self-setting, currently supported in the Android SDK level ldpi, MDPI, tvdpi, hdpi, xhdpi, xxhdpi, xxxhdpi
- Level pixel density: pixel density corresponding to pixel density level
- Logical pixel density: is the value set by the ROM manufacturer, which is usually the corresponding value of the screen density level closest to the actual screen density, but can also be set autonomously, through the system api,getresources (). Getdisplaymetrics (). densitydpi Can get to this value
- Pixels: Is the actual number of pixel units on the screen
- Size: is the actual size of the screen
- Logical dimensions: The actual number of pixels *160/the logical pixel density, which is also the formula for PX to DP
- True pixel density: Using the Pythagorean theorem to calculate the number of pixels/diagonal dimensions on the diagonal
- DP,DP is called device-independent pixels, for devices with true pixel densities equal to logical values on pixel density levels, 1DP = 1/160 inch, for devices not equal to logical values, such as the second device in the table above, 180.27! = 160 This difference Android The operating system is scaled to compensate. For example, in this device to use the 160DP to the end of the actual number of pixels on the screen, which actually went through 2 steps:
- In the DP program PX, according to the formula of DP to PX, on the device 160DP=160PX,160DP and our program with 160px is completely equivalent
- PX to the display in the program, 160px on the device display is a. 160px-180px This process is done automatically by the Android operating system, and we don't need to care
Cell phone screen density rating and screen logic size