开发者

How to determine height of the Display on Blackberry touch devices?

I trying to determine display vertical size of my Blackberry Storm 2.

I know, my device has 480 pixels height. I try to get this value in my code, but if virtual keyboard is shown, i get value equals to 480 - (height of virtual keyboard). Is there any function to determine real display height on any device (with or without keyboard, with enabled or disabled virtual keyboard).

Im also discover RIM classes:

I get these values with hidden virtual keyboard:

Display.getWidth(); //360
Display.getHeight(); //480
UiApplication.getUiApplication().getActiveScreen().getContentWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getContentHeight(); //480
UiApplication.getUiApplication().getActiveScreen().getWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getHeight(); //480
UiApplication.getUiApplication().getActiveScreen().getVirtualWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getVirtualHeight(); //480
UiApplication.getUiApplication().getActiveScreen().getVisibleWidth(); //360
UiApplication.getUiApplication().getActiveScreen().ge开发者_如何学PythontVisibleHeight(); //480

I get these values with showed virtual keyboard:

Display.getWidth(); //360
Display.getHeight(); //248
UiApplication.getUiApplication().getActiveScreen().getContentWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getContentHeight(); //248
UiApplication.getUiApplication().getActiveScreen().getWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getHeight(); //248
UiApplication.getUiApplication().getActiveScreen().getVirtualWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getVirtualHeight(); //248
UiApplication.getUiApplication().getActiveScreen().getVisibleWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getVisibleHeight(); //248

Is there any way to determine real screen height?


I would like to know workaround too

In the meantime you can store size of display for different devices and retrieve them depending on DeviceInfo.getDeviceName()

Or you can save Display.getHeight() value on app start

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜