Screen Adaptation

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.

  • Total pixels on the screen diagonal ≈ √(23402 + 10802) = 2577.20 (in pixels)
  • Screen size = 6.39 inches
  • PPI = 2577.20 / 6.39 ≈ 403.31

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

  • Zhao Kaiqiang's comprehensive Android screen adaptation guide
  • Renkai's essential Android screen knowledge for UI designers
  • DPI LOVE (https://dpi.lv/)
  • Various sources from Jianshu.com and Zcool.com

要查看或添加评论,请登录

ZhengYou Yang的更多文章

  • Cronet Metrics Monitoring

    Cronet Metrics Monitoring

    iOS How to Enable Metrics Monitoring It's crucial to initiate metrics monitoring before calling , as many configuration…

  • How to Download and Compile Cronet Source Code

    How to Download and Compile Cronet Source Code

    Introduction This blog will guide you through the steps to download and compile the Cronet source code. Cronet is a…

  • Analysis of Cronet Source Code - Native Implementation

    Analysis of Cronet Source Code - Native Implementation

    JNI Header Files Compiled outputs can be found in the directory. The key header files include: Set Minimum Log Level…

  • Analysis of Cronet Source Code - Java Implementation

    Analysis of Cronet Source Code - Java Implementation

    Based on Chromium Tag 94.0.

  • SDK Design Specifications

    SDK Design Specifications

    Meeting Functional Requirements Firstly, when designing an SDK, it is essential to consider user needs, define…

  • Screen Adaptation Plan

    Screen Adaptation Plan

    Background Due to the severe fragmentation of Android devices, the same layout displays differently on various phones…

  • Layout and UI Optimization

    Layout and UI Optimization

    Background Project Context: In the iterative process of project version implementation, some pages have complex UI…

  • Singleton for Retrofit and Network Request Optimization

    Singleton for Retrofit and Network Request Optimization

    I. Background Background: Currently, most requests in the project are made using Retrofit by declaring interfaces to…

  • Using Charles for Packet Capture

    Using Charles for Packet Capture

    Download Link Charles Web Debugging Proxy ? HTTP Monitor / HTTP Proxy / HTTPS & SSL Proxy / Reverse Proxy Cracked…

  • Computer Network Security

    Computer Network Security

    A. Draw the current LAN network for the above case description.

社区洞察

其他会员也浏览了