为什么2个相同尺寸,相同分辨率的设备要求不同的密度? [英] Why 2 devices of same size, same resolution, claims different density?

查看:81
本文介绍了为什么2个相同尺寸,相同分辨率的设备要求不同的密度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请查看

这2种设备具有相同的物理尺寸,相同的像素数,但声称具有不同的像素密度.

这与我对像素密度的理解相矛盾.

以下哪项是正确的?

  1. 我对像素密度的理解是错误的.页面上的所有信息都是正确的;
  2. 页面上的信息有误;
  3. 在HTC One M9上,尽管屏幕尺寸为5.0,但其中一小部分不用于显示(即实际显示尺寸小于Google Pixel)
  4. 我无法想象的事情

解决方案

一个朋友给了我一个解释,我认为这很可能是正确的答案:

答案是:4.我无法想象的事情

(1)这里的密度不是像素密度.是dp密度.

如果单击Google Pixel,您将看到px/in为441,与HTC One M9相同.这意味着它们的像素密度是相同的.在此值旁边,您会看到dp/in,这在这两个设备之间是不同的.对应于列表中的密度(2.6和3.0)

(2)这里的密度(dp-density)不一定具有物理意义

这是由于以下事实:在相同的像素密度下, Google和HTC决定以不同的方式定义一个dp单位.这就是为什么即使在相同的像素密度下它们也具有不同的dp值.这将产生一种效果,即使您指定了相同的dp值,这两个设备上的 View 也会具有不同的物理大小.
只有整个世界都符合1x = 160dpi的标准,dp才能用作物理指标.

Please take a look at Material IO's device metrics:

Pay attention to Google Pixel and HTC One M9.

These 2 devices have the same physical size, same number of pixels, but claimed to have different pixel densities.

This contradicts with my understanding of pixel density.

Which of the following is true?

  1. My understanding of pixel density is wrong. All information on the page is correct;
  2. The information on the page is wrong;
  3. On HTC One M9, although the screen size is 5.0, a small part of it is not used to display (i.e. Actual display size is smaller than Google Pixel)
  4. Something that I can't imagine

解决方案

A friend gave me an explanation and I think it is very likely to be the correct answer:

The answer is: 4. Something that I can't imagine

(1) The density here is not pixel density. It is dp-density.

If you click on Google Pixel, you will see px/in is 441 which is the same as HTC One M9. This means their pixel densities are the same. And next to this value you see a dp/in which is different among these 2 devices. That correspond to the density on the list (2.6 and 3.0)

(2) The density (dp-density) here does not necessarily has physical meaning

This is due to the fact that under same pixel density, Google and HTC decided to define one unit of dp differently. That's why they have different values of dp even under same pixel density. This will create an effect that even if you specify the same value of dp, the View will have different physical size on these 2 devices.
Only if the whole world conform to the standard of 1x = 160dpi, dp can be used as a physical metrics.

这篇关于为什么2个相同尺寸,相同分辨率的设备要求不同的密度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆