如何根据屏幕(或显示器)尺寸调整组件的尺寸?

发布于 2024-12-06 20:20:53 字数 202 浏览 2 评论 0原文

我在另一部手机(htc 手机)上测试了我的应用程序,它的屏幕尺寸非常大。所以当我看到组件的排列时我非常惊讶!这是从另一部手机的摄像头捕获的屏幕图像:

在此处输入图像描述

那么如何使组件成为根据任何设备的屏幕显示尺寸调整尺寸和放置位置?

I tested my application in another mobile phone , a htc mobile phone , and it has a very large screen size. So I was very surprised when I saw the arrangement of the components ! Here is the captured image of the screen from the camera of another phone :

enter image description here

So how to make the components be sized and placed well according to the screen display size of any device ?

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

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

发布评论

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

评论(1

萌酱 2024-12-13 20:20:53

AFAIF LWUIT 组件根据分辨率自动调整大小。我认为您正在为这些组件使用 setMarginsetPadding 。所以你需要根据分辨率来处理它们。获取移动设备的分辨率并更改组件边距和填充。使用此代码获取分辨率,

int screen_width = Display.getInstance().getDisplayWidth();
int screen_height = Display.getInstance().getDisplayHeight();

AFAIF LWUIT components automatically resized based on resolution. I think you are using setMargin or setPadding for those components. So you need to handle them based on resolution. Get the resolution for the mobile and change the component margin and padding. use this code for get resolutions,

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