Why does my Galaxy Note 3 have the same DP dimensions as a much smaller phone?

纵然是瞬间 提交于 2019-12-04 17:38:59
Onik

Because it's not just a matter of screen size, it is also a matter of screen density. I'll explain. The convertation formula from px to dp units is as follows:

dp = px * 160 / dpi, where dpi is your screen density.

Consequently, from the values you calculated (let's take the width) we have the following values for the screen density:

Galaxy Note 3 (width = 1080 px): dpi = 1080 * 160 / 360 = 480

Moto X (width = 720 px): dpi = 720 * 160 / 360 = 320.

Galaxy Note 3 and Moto X have the same width = 360 dp because of equal width/dpi ratio = 2.25 (same for the height/dpi ratio = 4). Now imagine Moto X has the same density as Galaxy Note 3. In that case you'd get a smaller width = 240 dp for Moto X.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!