Search code examples
androidandroid-layoutdpiscreen-size

Does 15dp represent the same physical size (say 7millimeters on screen) in every device? (Android)


I found many definitions for 'dp' among the answers, but none of these answered this exact question.

It is said 'dp' is dpi independent.

So if you draw a line of 50dp programatically in your app and measure its actual size using a ruler(a tangible plastic ruler) and do this in 10 different devices with different screen sizes you will get the same length on the ruler?


Solution

  • On 10 different devices with different configurations, will I get the same length on the ruler with a 50dp line drawn?

    Simplest answer, NO

    However, it is very close! And that is all that matters.

    For a 48 x 48 dp touch target... Physical size on any device will be a square of size 9 ± 2mm

    Check out this link from Google: https://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylines-touch-target-size