5

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 ?

morfioce
  • 1,107
  • 2
  • 9
  • 12

2 Answers2

3

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.

enter image description here

enter image description here

SuperFrog
  • 7,631
  • 9
  • 51
  • 81
  • 6
    Does this answer address why dpi was used over ppi? It seems to me like they are identical measurements that just have a different baseline... ppi is based off 1 inch, and Google's dip (device independent pixel) is based off the 160 ppi on one of their devices... – Francisco Aguilera Apr 25 '16 at 22:41
  • 3
    Why is it accepted answer? I don't think I understood why we use dpi over ppi. I already know why we need dpi. – Heisenberg Jul 05 '16 at 14:47
3

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.

Barnabus
  • 376
  • 3
  • 14