如何在 LWUIT 检测 j2me 移动设备屏幕方向?
我想知道如何在 J2ME LWUIT 中检测屏幕方向,例如纵向或横向模式。 LWUIT可以自动检测屏幕方向还是需要手动编写代码?
I want to know how to detect screen orientation like portrait or landscape mode at J2ME LWUIT. Can LWUIT detect screen orientation automatically or need to write code manually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Shai Almog 在论坛上这样说,谈到屏幕方向
Shai Almog 说...
我们没有明确支持方向,手机发送屏幕尺寸变化的事件,它为我们支持方向。我们知道大小已经改变,但我们不知道方向已经改变。
开发人员无法控制方向更改,因为这是根据画布事件自动完成的。
http://lwuit.blogspot .com/2008/05/new-video-from-chen-of-lwuit-on-devices.html
我认为它可以帮助你。我现在正在使用 LWUIT 资源编辑器开发一个应用程序,并且会自动检测屏幕方向。无论如何,你必须在 API http://lwuit.java.net/nonav/iodocs 中查找 Display /index.html,您可以使用一些方法来确定方向,例如
Display.canForceOrientation()
或Display.lockOrientation()
。Shai Almog said this in the forum, talking about screen orientation
Shai Almog said...
We don't explicitly support orientation, the phone sends an event of screen size change and it supports orientation for us. we know the size has changed but we don't know the orientation has changed.
The developer can't control orientation changes since this is done automatically based on events to the canvas.
http://lwuit.blogspot.com/2008/05/new-video-from-chen-of-lwuit-on-devices.html
I think it can help you. I am developing an app with LWUIT now, using the LWUIT resource editor, and the screen orientation is detected automatically. Anyway you must look for Display in API http://lwuit.java.net/nonav/iodocs/index.html, there are some methods that you can use for the orientation, like
Display.canForceOrientation()
orDisplay.lockOrientation()
.Display.getInstance().isPortrait() 怎么样
What about
Display.getInstance().isPortrait()