Difference between android dimension: pt and dp

前端 未结 7 1925
迷失自我
迷失自我 2020-11-30 18:28

The documentation says that 160 dp (density-independent) equals 1 inch. And 72 pt is also 1 inch. So I don\'t see why android define a dp measurement while it seems to work

7条回答
  •  無奈伤痛
    2020-11-30 19:04

    pt Points - 1/72 of an inch based on the physical size of the screen.

    dp Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".

提交回复
热议问题