How to adjust component's size according to the screen ( or display ) size?
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 :
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();
精彩评论