Is dp based on the physical size of the screen? (dp =1/160 of an inch)

后端 未结 2 850
隐瞒了意图╮
隐瞒了意图╮ 2021-01-12 16:08

Is this definition correct?

dp Density-independent Pixels - 1/160 of an inch based on the physical size of the screen.

I have found conflicting info

相关标签:
2条回答
  • 2021-01-12 16:53

    A measurement unit like mm or in would be way less confusing since dp measures the same real world observed length. It would be misleading on the other hand since dp is not an absolutely defined unit.

    The use of screen density buckets means that dp is a bit fuzzy - but it will stay within reasonable (+/-20% ?) accuracy. Real world displays are usually not exactly e.g. 160dpi they can be 173.4 dpi and still be classified as 160dpi. The math carried out to convert from dp to pixels on the screen is done based on these buckets and that means that the accuracy of dp depends on how accurately your device screen meets it's classification.

    But to clear your doubt: 160dp is always 1 (fuzzy) inch regardless of what device you hold in your hand. Easier to think of: 50dp = 1 (small) finger wide.


    px Pixels on the other hand are actual pixels. A full HD display has 1920x1080 of them but that unit says nothing about the screen size or how big such a pixel will appear to the user. dp or dip is a different unit and should have never been called "pixel" in my opinion.

    0 讨论(0)
  • 2021-01-12 17:02

    Check out this out after 20:00

    http://www.youtube.com/watch?v=pBKGbCu0pJg&list=PLWz5rJ2EKKc8j2B95zGMb8muZvrIy-wcF

    Join Nick Butcher, Adam Koch and Roman Nurik discussing all about Android Units of measure.

    0 讨论(0)
提交回复
热议问题