开发者

How to adjust component's size according to the screen ( or display ) size?

开发者 https://www.devze.com 2023-04-07 16:31 出处:网络
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

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 :

How to adjust component's size according to the screen ( or display ) size?

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


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();
0

精彩评论

暂无评论...
验证码 换一张
取 消