开发者

MapField Display problem

I want to display MapField on Storm on Full Screen and for this i am using MapField.setPreferredSize(Display.getWidth,Display.getHeight) . But instead of seeing MapField of dimensions 320X480 ,i get MapField of dimensions of roughly 320X280 and remaining space(480-280 = 200) filled with black colour..I have crosschecked values开发者_运维百科 of Display.getWidth() and Display.getHeight(320 , 480)


The problem is that on a Storm, Display.getWidth() and getHeight() don't return the same thing all the time-- they attempt to account for the presence (or not) of the soft keyboard. The point at which the system decides the keyboard is there or not is pretty irrational. (The Storm absolutely sucks, as I guess you've figured out.)

One way that seems to work is subclass sublayout(width, height) in your Screen. This will get called multiple times on the Storm, as the system flops its way around figuring out what's going on. So it means more calculation, but it works. The last values you see through there will be right.

Here's a rough template. Remember this is in your class that extends the Screen. (e.g. MainScreen)

protected void sublayout(int width, int height) {
    super.sublayout(width, height);
    // the screen is acutally width X height
    // do your screen-specific stuff here
}


It sounds like your application is running in compatibility mode. You can check this using Application#isInTouchCompatibilityMode(). Touch Compatibility Mode fixes the drawable region of the Storms to 320x240, like you're experiencing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜