问题
According to the android documentation, density should be in dpi (dots per inch) and all layout measurement should be in dp.
and using a simple formula android can map dp to actual pixels.
px = dp * (dpi / 160),
160dpi ~ medium density screen which is the baseline
So why not just use ppi (pixels per inch) to describe screen density ?
回答1:
There is a lot of documentation about this issue, but I think this part is relevant for your question:
Supporting Multiple Screens
Density independence
Your application achieves "density independence" when it preserves the physical size (from the user's point of view) of user interface elements when displayed on screens with different densities.
Maintaining density independence is important because, without it, a UI element (such as a button) appears physically larger on a low-density screen and smaller on a high-density screen. Such density-related size changes can cause problems in your application layout and usability. Figures 2 and 3 show the difference between an application when it does not provide density independence and when it does, respectively.
回答2:
From what I've read it is a design based distinction; the developers shouldn't worry about the individual screens they are deploying to, and should use dp within the application to make it as portable as possible across the different android devices.
For designers of assets the display size and sharpness of image are more important, and the dpi distinction is the one that matters to them.
For more information check out this article/e-book written by a google engineer:
http://sebastien-gabriel.com/designers-guide-to-dpi/
In particular check out the section "The PPI Configuration". Quote from the article:
Anything non-print uses pixel sizes regardless of the initial PPI configuration... PPI configuration in software is a printing legacy. If you design only for the web, PPI won't have any influence on the size of your bitmap.
来源:https://stackoverflow.com/questions/32549719/android-screen-density-dpi-vs-ppi