如何获取垂直和水平像素数?

发布于 2024-11-16 09:37:14 字数 177 浏览 4 评论 0原文

我想显示一个带有方法签名的对话框 show(int top, int Bottom, int left, int right, boolean includeTitle)

我想将此对话框放置在屏幕中央。所以我想知道屏幕垂直方向的总像素数和屏幕水平方向的总像素数。

如何实现这一目标?

I want to show a Dialog with the method signature show(int top, int bottom, int left, int right, boolean includeTitle)

I want to place this Dialog in the center of the screen. So I want to know the total number of pixels of the screen vertically and the total number of pixels of the screen horizontally.

How to achieve that ?

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

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

发布评论

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

评论(1

埖埖迣鎅 2024-11-23 09:37:14

如果您正在寻找在 LWUIT 中为您提供这些维度的方法,那么
您获得对 Display Display.getInstance()
的引用
然后你可以调用 getDisplayHeight() 或 getDisplayWidth();
但如果你想使用 MIDP 类,你必须获得对 Display
的引用
通过调用 Display.getDisplay(Midlet instance) 然后获取对
的引用
current Displayable getCurrent(),然后您可以调用 getWidth()getHeight()

If you're looking for the methods that give you these dimensions in LWUIT then
you obtain a reference to the Display Display.getInstance()
then you can call getDisplayHeight() or getDisplayWidth();
but if you want to use MIDP classes you have to get a reference to the Display
by calling Display.getDisplay(Midlet instance) and then getting a reference to the
current Displayable getCurrent() and then you can call getWidth() or getHeight().

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