2011-05-13 126 views
6

http://developer.android.com/guide/practices/screens_support.html状态:如何获得广义屏幕尺寸?

术语和概念

屏幕尺寸的实际物理尺寸, 作为屏幕的对角线测量。对于 的简单性,Android将所有实际的 屏幕尺寸分为四种广义的 尺寸:小,正常,大和额外 大。

如何以编程方式获取设备屏幕的广义尺寸?我正在查找的方法或属性将返回以下之一:小,正常,大和超大。 (或可以映射到那些const /枚举)

谢谢。

-mz

+0

阅读本文可能会帮助您http://androidtrainningcenter.blogspot.in/2012/01/plan-design-in-best-way-for-multiple.html – Sameer 2012-02-08 12:44:44

回答

7

使用screenLayoutConfiguration对象。

+3

此问题的代码显示在此问题中:http ://stackoverflow.com/questions/5015094/determine-device-screen-category-small-normal-large-xlarge-using-code – stealthcopter 2011-05-14 12:18:59