如题,一般获取手机像素密度有两种方式,第一个是从DisplayMetrics获取densityDpi。另外一个是手动计算
Math.sqrt(屏幕宽^2 + 屏幕高^2)/ 屏幕尺寸得出的。
我的问题是:相同的设备计算出来的是一个值而densityDpi是另一个值,为什么二者不同而且差距很大?
阿神2017-04-17 17:52:03
The width of the screen refers to the pixel value of the wide side of the screen.
The height of the screen refers to: the pixel value of the high side of the screen.
Screen size is: diagonal size.
If these three values are correct, they must be the same as the densityDpi obtained by DisplayMetrics.