Screen Adaptation
PPI & DPI
PPI PPI (Pixels Per Inch) refers to the number of pixels in one inch of a screen. Typically, pixels are square or nearly square, meaning the density is the same on both the X and Y axes, though there are exceptions.
PPI represents the number of pixels along the diagonal per inch.
What is DPI? DPI (Dots Per Inch) is a measurement unit for the resolution of printers, mice, and other devices. It is a primary parameter for assessing the print precision of a printer: the higher the DPI, the finer the print quality.
What is Screen Size?
Screen size refers to the diagonal size mentioned above, which is a physical dimension. The reason for using the diagonal might be historical or simply because it appears larger, which is more appealing to customers.
Screen resolution refers to the number of pixels displayed horizontally and vertically, measured in px (pixels).
Clarifying Concepts and Differences PPI = (total pixels on the screen diagonal) / (screen size in inches). For example, let’s verify the PPI of a certain Xiaomi phone as advertised.
Using the tool DPI LOVE (https://dpi.lv/), the calculated result matches the advertised parameters. As for whether the screen size and resolution match, that is easy to verify. According to Apple's former CEO Steve Jobs in 2010 during the iPhone 4 launch, “When you hold something 10-12 inches (about 25-30 cm) away, if its resolution reaches the ‘magical number’ of 300 PPI (300 pixels per inch), your retina can no longer distinguish the pixels.” Based on this, the phone's PPI is quite excellent.
To summarize, PPI = √(X2 + Y2) / Z (X: pixel count in length; Y: pixel count in width; Z: screen size).
Now let’s look at DPI. It is the number of dots per inch. While inch is the screen size, what does dot mean? DPI pertains to dot matrix digital images, and here, dots refer to ink dots. According to another explanation:
DPI predates PPI and is mainly used to describe ink dot density in the printing field, whereas PPI is used for pixel density on electronic display screens.
领英推荐
DPI vs PPI For those still unclear about the concepts and differences between DPI and PPI, it is recommended to read the article “Ten Minutes to Quickly Understand DPI and PPI, No Longer Confused!”. This should clarify the distinction between DPI and PPI.
In Android development, although PPI is used for screens, DPI is the term commonly applied.
Why Logical DPI? In screen display devices, both screen resolution and size are physical units. One pixel corresponds to one physical dot (composed of three sub-pixels: red, green, and blue). However, in the printing field, a dot refers to an ink dot whose size is determined by the printing equipment's precision. For instance, in a grid notebook, using a smaller pencil tip allows for more dots in the same grid, enhancing display precision. Similarly, a pixel (screen) can correspond to multiple physical dots (ink), improving print quality.
In display systems, PPI (physical pixel density) is constant and represents the number of pixels per inch. However, logical DPI can be altered to map physical PPI, allowing for flexibility in software settings without changing the actual screen hardware. This distinction allows logical resolution changes without altering physical resolution.
For example, on an Android device, the physical density might be set by the manufacturer, but can be overridden for development purposes, affecting how the system handles screen density.
Conclusion PPI and DPI are different concepts used in different fields. PPI refers to the physical pixel density on screens, while DPI refers to the logical pixel density managed by the system. Despite the technical differences, in most practical scenarios, treating PPI and DPI as interchangeable concepts does not cause significant issues.
Android Screen Adaptation
Basic Concepts For detailed reading on Android screen adaptation, refer to articles by Zhao Kaiqiang and Renkai on comprehensive screen adaptation guides and essential Android screen knowledge for UI designers.
Android Adaptation Principle Android uses logical density (DPI) to adapt to different device resolutions and sizes.
Android classifies DPI sizes into categories like ldpi (120dpi), mdpi (160dpi), hdpi (240dpi), xhdpi (320dpi), xxhdpi (480dpi), etc. These classifications help in managing drawable folders and value folders in Android to differentiate image resources and dimension values based on screen density.
In summary, PPI and DPI are fundamental concepts in screen adaptation, used to describe physical and logical pixel densities respectively. This understanding aids in better managing screen resolutions and sizes across different devices in Android development.
References