The formula is:DPI: dpi
Resolution Width: rWidth
Resolution Height: rHeight
Screen Width: iWidth
Screen Height: iHeightdpi * dpi = (rWidth * rHeight) / (iWidth * iHeight)such as:dpi = 160
rWidth = 240
rHeight = 320
iWidth = 1.5"
iHeight = 2"160 * 160 = (240 * 320) / (1.5 * 2)The most important, this formula is not equal, but is approximately equal. Take care of it.

解决方案 »

  1.   

    even if its width is 1.8", 1.3", etc.现在明白了。是上面这句话看得稀里糊涂的,刚理解过来。
    谢谢yyy025025025
      

  2.   

    And so on, the DIP calculate with the xdpi and ydpi, not the real resolution.
      

  3.   

    转自另一论坛的回帖:1.标准是240*320画在1.5*2平方inch上。那么像每平方英寸有240*320/(1.5*2)=25600点,也就是一平方英尺的像素点为 25600,所以dpi取为它的平方根160;如果你的dpi是120,那么它的密度就是0.75
    2. 它要说明的是密度不只是与width有关,还与height有关,所以举例说,不管width是1.8还是1.3,它的密度都有可能是1;比如width 是1.8,只要它的height是3/1.8的话,如果pixel为240*320的话,它的密度仍旧是1;同样如果width为1.3,只要它的 height为3/1.3的话,像素点为240*320,则密度也是1.
    3. 320*480/(1.5*2)得到单位平方英寸的点为51200,所以单位平方英寸是240*320画在1.5*2屏幕的2倍。但是这是平方英寸啊,算密度的时候要开平方的啊,所以应该是2开平方,是1.414吧,大致密度为1.5