|
Replies:
4
-
Last Post:
Nov 12, 2008 6:29 AM
by: rlopes
|
|
|
|
|
|
|
LWUIT and Diffrent phone Screen Size
Posted:
Nov 11, 2008 7:32 AM
|
|
|
Hi, I would like to test my developed an LWUIT based application On different screen size's emulator?I heart that LWUIT support by default different screen size emulators and adjust according that.
I am running this app on to the small screen size phone and found that my created GUI component is not shows to me properly.But when i goto resources file and made changes into the Font size then it's take affected and then my GUI shows me properly and the component adjust according to size.
So my question is that Can i have to prepare different version of application in which i have to made the changes into the resources file and deployed into the Small screen size phone? Or It's not possible that i can use the same version and LWUIT GUI adjust according to the Phone screen size?
Thanks in advanced.
Rajesh
|
|
|
|
|
|
|
Re: LWUIT and Diffrent phone Screen Size
Posted:
Nov 11, 2008 8:51 PM
in response to: rjounwal
|
|
|
Hi, I agree with Rajesh. And I will also like to understand how can we make sure that if we are using images they are auto scaled as per the phone's screen size. Thanks, Avinash
|
|
|
|
|
|
|
|
Re: LWUIT and Diffrent phone Screen Size
Posted:
Nov 12, 2008 3:30 AM
in response to: rjounwal
|
|
|
LWUIT aims to create only one version of the application that adapts itself to the device, but it doesn't do all by itself, the code you develop have to follow that approach too.
You can use the default system fonts with relative sizes (small, medium, large) that are set by the phone manufacturer to be the best for that screen dimensions & dpi.
If you really want to use custom fonts you can include several sizes and at startup choose and set the best for the device using the one that is closer to the system font size for that device.
I also define the desired size for the images i use on the application in "device font units", scale ratio increments and maximum size. For example: in my app i say that image "icon1" should be 1.5X the size of the device small font height and should be scaled in 25% increments to the closest value of the desired size, up to a maximum value for example 300%.
It had given me good results across devices with different screen sizes and dpi if you carefully choose your images and define well the scaling characteristics.
Hope that helps.
|
|
|
|
|
|
|
|
RE: LWUIT and Diffrent phone Screen Size
Posted:
Nov 12, 2008 5:51 AM
in response to: rlopes
|
|
|
Thanks for that post. When you say:
"device font units",
how do you get the numbers/relations of the system font sizes in differerent devices?
-----Original Message----- From: lwuit-users@mobileandembedded.org [mailto:lwuit-users@mobileandembedded.org] Sent: Mittwoch, 12. November 2008 12:30 To: users@lwuit.dev.java.net Subject: Re: LWUIT and Diffrent phone Screen Size
LWUIT aims to create only one version of the application that adapts itself to the device, but it doesn't do all by itself, the code you develop have to follow that approach too.
You can use the default system fonts with relative sizes (small, medium, large) that are set by the phone manufacturer to be the best for that screen dimensions & dpi.
If you really want to use custom fonts you can include several sizes and at startup choose and set the best for the device using the one that is closer to the system font size for that device.
I also define the desired size for the images i use on the application in "device font units", scale ratio increments and maximum size. For example: in my app i say that image "icon1" should be 1.5X the size of the device small font height and should be scaled in 25% increments to the closest value of the desired size, up to a maximum value for example 300%.
It had given me good results across devices with different screen sizes and dpi if you carefully choose your images and define well the scaling characteristics.
Hope that helps. [Message sent by forum member 'rlopes' (rlopes)]
http://forums.java.net/jive/thread.jspa?messageID=316244
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net For additional commands, e-mail: users-help@lwuit.dev.java.net
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net For additional commands, e-mail: users-help@lwuit.dev.java.net
|
|
|
|
|
|
|
|
Re: RE: LWUIT and Diffrent phone Screen Size
Posted:
Nov 12, 2008 6:29 AM
in response to: saturon
|
|
|
Every manufacturer chooses the optimum font sizes for the device and its user interface. There are 3 default values SIZE_SMALL, SIZE_MEDIUM and SIZE_LARGE, i consider the small size at minimum readable font size for that mobile screen and define my images according to that scale.
Those values changes between mobile phone and you can get them using this code:
on lwuit:
int smallFontHeight = com.sun.lwuit.Font.createSystemFont(com.sun.lwuit.Font.FACE_SYSTEM, com.sun.lwuit.Font.STYLE_PLAIN, com.sun.lwuit.Font.SIZE_SMALL).getHeight();
int mediumFontHeight = com.sun.lwuit.Font.createSystemFont(com.sun.lwuit.Font.FACE_SYSTEM, com.sun.lwuit.Font.STYLE_PLAIN, com.sun.lwuit.Font.SIZE_MEDIUM).getHeight();
int largeFontHeight = com.sun.lwuit.Font.createSystemFont(com.sun.lwuit.Font.FACE_SYSTEM, com.sun.lwuit.Font.STYLE_PLAIN, com.sun.lwuit.Font.SIZE_LARGE).getHeight();
or in lcdui:
int smallFontHeight = javax.microedition.lcdui.Font.getFont(javax.microedition.lcdui.Font.FACE_SYSTEM, javax.microedition.lcdui.Font.STYLE_PLAIN, javax.microedition.lcdui.Font.SIZE_SMALL).getHeight();
int normalFontHeight = javax.microedition.lcdui.Font.getFont(javax.microedition.lcdui.Font.FACE_SYSTEM, javax.microedition.lcdui.Font.STYLE_PLAIN, javax.microedition.lcdui.Font.SIZE_MEDIUM).getHeight();
int largeFontHeight = Font.getFont(javax.microedition.lcdui.Font.FACE_SYSTEM, javax.microedition.lcdui.Font.STYLE_PLAIN, javax.microedition.lcdui.Font.SIZE_LARGE).getHeight();
Im not 100% sure of the lwuit code because i still use the lcdui one when in initializing my midlets, i'm only using lwuit for a week, but it should work
|
|
|
|
|