LWUIT 表单中的菜单栏高度
使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您在本应输入
getDisplayHeight()
的地方输入了getDisplayWidth()
。无论如何,您看到的问题是由于三星设备中的错误造成的。 LWUIT 在 MIDP 中调用全屏模式,隐藏本机标题区域,但是在某些设备中这并不总是立即发生,因此 LWUIT 从设备获取不正确的信息。刷新通常可以解决此问题,并且当 LWUIT 在屏幕上绘制时,尺寸已得到纠正。
一般来说,解决方案相当简单,创建通用代码来创建图像,如果当您要绘制到屏幕上时图像尺寸不合适,则只需动态重新创建图像即可。这也将解决设备旋转的问题,这也可能会带来问题。
I think you typed
getDisplayWidth()
where you meant to typegetDisplayHeight()
.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.