android dp

  http://www.see-say.com/viewnews-47657.html

  http://cn.club.vmall.com/thread-970026-1-1.html

  http://www.jianshu.com/p/913943d25829

  When adding support for multiple screens, applications do not work directly with resolution; applications should be concerned only with screen size and density, as specified by the generalized size and density groups.
  

  DPI的全称是 Dots Per Inch,Inch是一个物理单位(无论在任何设备上,其大小都是固定的),所以DPI就指在一个Inch的物理长度内有多少个Dot,160DPI的屏幕就表示一个Inch包含160个Dot,320DPI的屏幕表示一个Inch有320个Dot,所以说Dot的大小是不固定的。

  在Android设备中,DPI 等价于 PPI。

  通常我们说一个设备是多少寸时,指的是屏幕对角线(Diagonal)是多少inch,所以用对角线的像素值(px)除以对角线长度(inch),就可以计算出PPI。

  px = dp * (dpi / 160)

  dp的功能,它能保证在所有的设备上显示的大小都一样。

  

原文地址:https://www.cnblogs.com/wendao/p/5443294.html