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.
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.
谢谢yyy025025025
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