Appengine | Sign in

云在千峰


htc desire screen size

这篇文章中提到了如何获取Android系统的屏幕分辨率,最近在测试一个程序的时候,发现HTC Desire手机通过
android.view.Display 返回的屏幕尺寸是320 x 533,而不是传说中的480X800.

通过打印DisplayMetrics的信息:

DisplayMetrics{density=1.5, width=320, height=533, scaledDensity=1.5, xdpi=254.0, ydpi=254.0}

发现 屏幕的物理尺寸(像素)等于 Display返回的尺寸乘以 density . 有点奇怪, 难道是文档中的说明不太清楚?

关于DisplayMetrics属性的Android 文档描述:

public float   density        The logical density of the display.
public int     densityDpi     The screen density expressed as dots-per-inch.
public int     heightPixels   The absolute height of the display in pixels.
public float   scaledDensity  A scaling factor for fonts displayed on the display.
public int     widthPixels    The absolute width of the display in pixels.
public float   xdpi           The exact physical pixels per inch of the screen in the X dimension.
public float   ydpi           The exact physical pixels per inch of the screen in the Y dimension.



| 评论 | 标签: android
blog comments powered by Disqus