android - 关于手机像素密度的问题
PHPz
PHPz 2017-04-17 17:50:03
0
1
684

如题,一般获取手机像素密度有两种方式,第一个是从DisplayMetrics获取densityDpi。另外一个是手动计算
Math.sqrt(屏幕宽^2 + 屏幕高^2)/ 屏幕尺寸得出的。

我的问题是:相同的设备计算出来的是一个值而densityDpi是另一个值,为什么二者不同而且差距很大?

PHPz
PHPz

学习是最好的投资!

reply all(1)
阿神

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!