android - 了解三星 Galaxy Tab 屏幕密度

标签 android screen screen-resolution galaxy galaxy-tab

有人会说,如果 Galaxy Tab 屏幕分辨率(纵向模式)为 600px 并且屏幕宽度为 3.55inch,则屏幕密度将为 600/3.55 = 169 dpi。了解并牢记设备独立像素 (dp) 的计算方式 (http://developer.android.com/guide/practices/screens_support.html):

px = dp * (dpi / 160);
600 = dp * (169 / 160);
dip = 568

因此从位置 0 开始绘制一条 568dp(设备独立像素)宽度的水平线必须与屏幕的宽度完全匹配。但是,如果您在设备上尝试这样做,您会发现屏幕宽度为 400dp。我将再次使用相同的公式,但用于获取 dpi:

600 = 400 * (dpi / 160);
dpi = 240

240dpi3.55inch 屏幕宽度和 600pixels,是否意味着一个物理像素由更多“点”组成否则参数对应的宽度为852pixel (3.55*240)

我以为dpi是dots per inch,也就是像素每英寸。但这似乎不是真的……

稍后添加:
这 ( http://developer.android.com/guide/topics/resources/more-resources.html#Dimension ) 说:

160dp is always one inch regardless of the screen density

这不是真的。只需从这里检查测量源: Difference between android dimension: pt and dp

更晚添加:
我问的原因是违反 160dp = 1inch 的规则会导致这样一个事实,即在将控件宽度指定为例如320dp 它将在 Galaxy Tab 上覆盖真正必要的更大部分,并且比您对 600x1024px 屏幕的期望大得多...

感谢您的澄清 BR 斯腾

最佳答案

Galaxy Tab (7") 未报告其真实密度。要了解此问题,请阅读以下文章:

http://realmike.org/blog/2010/12/21/multiple-screen-sizes-with-processing-for-android/

Apparently, that’s also what Samsung found when they made the Galaxy Tab. The Galaxy Tab has a 7″, 1024×600 screen with 170 dpi. Yet, the Tab does not report its density as “mdpi” but as “hdpi”, so the layout looks exactly as in the second screenshot. If they used “mdpi”, the icons would be .28″ wide, with “hdpi”, they are .42″ wide—not a big deal, and I must admit, the layout does look prettier this way.

这篇文章包含一些图片,可以让您理解问题。

关于android - 了解三星 Galaxy Tab 屏幕密度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7049659/

相关文章:

java - 如何保存和加载Android图像

android - 找不到类 javax.naming.directory.InitialDirContext

java - 在硬件设备上运行时出现 Android Studio 错误

ios - 将 UIImage 从 URL 添加到 ruby​​motion 应用程序中的促销屏幕

android - 高分辨率屏幕的不同布局?

javascript - javascript 中的 screen.width 和 screen.availwidth 区别

android - 不休眠测试 PendingIntent 发送

android - 如何以数学方式计算 Android 屏幕纵横比

ios - 在某种情况下移动到下一个屏幕?

java - 更改 Android 中应用程序的 DisplayMetrics(API 级别低于 17)