android获取其他屏幕方向的屏幕大小

Xaz*_*zen 6 android screen-orientation screen-size

从Android 3.0开始,显示屏上有一个带有后退和主页按钮的导航栏.现在,如果我得到这样的屏幕尺寸

ClockLwp.ScreenHeight = getWindowManager().getDefaultDisplay().getHeight();
ClockLwp.ScreenWidth = getWindowManager().getDefaultDisplay().getWidth();
Run Code Online (Sandbox Code Playgroud)

这个的

getResources().getDisplayMetrics().widthPixels
getResources().getDisplayMetrics().heightPixels
Run Code Online (Sandbox Code Playgroud)

我对风景和肖像有不同的价值.这是我的意思的一个例子:

Acer Iconia A500人像模式:800 x 1232 Acer Iconia A500风景模式:1280 x 752

AFAIK适用于所有带有这种导航栏的设备.(例如三星Galaxy Nexus,GalaxyTab 10.1等)

现在我的问题是,如果我处于纵向模式,我怎样才能获得横向模式的值,反之亦然?

Bla*_*elt 1

从 android 3 开始,公共 api 无法检索原始高度和宽度。你可以通过反思。寻找 getRawHeigth/Width