Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想显示一个带有方法签名的对话框show(int top, int bottom, int left, int right, boolean includeTitle)
show(int top, int bottom, int left, int right, boolean includeTitle)
我想把这个对话框放在屏幕的中央。所以我想知道屏幕垂直的总像素数和屏幕水平的总像素数。
如何做到这一点?
如果您正在寻找在 LWUIT 中为您提供这些尺寸的方法,那么 您将获得对 Display 的引用,Display.getInstance() 然后您可以调用 getDisplayHeight() 或 getDisplayWidth(); 但是如果你想使用 MIDP 类,你必须 通过调用来获取对 Display 的引用Display.getDisplay(Midlet instance),然后获取对 当前 Displayable的引用getCurrent(),然后你可以调用getWidth()or getHeight()。
Display.getInstance()
Display.getDisplay(Midlet instance)
getCurrent()
getWidth()
getHeight()