LWUIT 表单中的菜单栏高度

发布于 2024-12-14 14:36:28 字数 328 浏览 2 评论 0原文

使用 LWUIT 在 J2ME 中开发应用程序。当我将此应用程序移植到三星设备上时,会出现以下问题。

int h = Display.getInstance().getDisplayWidth();

对于 Samsung GT S5250,它返回 388。因此,当我使用此尺寸绘制图像时,它会在屏幕底部显示一条白色条带。当我调用 Form.show() 它显示正确并且高度为 400 那么如何解决这个问题。 我想知道LWUIT中如何计算Form大小以及如何获取MenuBar高度以及屏幕底部的白色条显示。

Application develop in the J2ME using LWUIT. When I port this application on the Samsung Device it create the following problem.

int h = Display.getInstance().getDisplayWidth();

It returns 388 for the Samsung GT S5250. So when I draw an image using this dimension it displays a white strip at the bottom of the screen. When I call the Form.show() it displays correctly and height is 400 so how to resolve this issue.
I want to know how the Form size is calculated in LWUIT and how it takes MenuBar Height and white strip display at bottom of the screen.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

番薯 2024-12-21 14:36:28

我认为您在本应输入 getDisplayHeight() 的地方输入了 getDisplayWidth()

无论如何,您看到的问题是由于三星设备中的错误造成的。 LWUIT 在 MIDP 中调用全屏模式,隐藏本机标题区域,但是在某些设备中这并不总是立即发生,因此 LWUIT 从设备获取不正确的信息。刷新通常可以解决此问题,并且当 LWUIT 在屏幕上绘制时,尺寸已得到纠正。

一般来说,解决方案相当简单,创建通用代码来创建图像,如果当您要绘制到屏幕上时图像尺寸不合适,则只需动态重新创建图像即可。这也将解决设备旋转的问题,这也可能会带来问题。

I think you typed getDisplayWidth() where you meant to type getDisplayHeight().

Regardless, the problem you are seeing is due to a bug in the samsung device. LWUIT invokes the full screen mode in MIDP which hides the native title area, however that doesn't always happen immediately in some devices and thus LWUIT gets incorrect information from the devices. A refresh usually solves this and by the time LWUIT draws on the screen the size is corrected.

Generally the solution is rather simple, create generic code to create your image and if the image dimensions are inappropriate when you are about to draw to the screen then just recreate the image on the fly. This will also solve the issue of device rotation which might pose a problem too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文