Skip to main content

use of layout in LWUIT

4 replies [Last post]
nisha_dh
Offline
Joined: 2010-07-30

Hii all,

I again hav another question. In my form , i am having three buttons. Either i use BoarderLayout.Center, or BoxLayout.Y_Axis layout, those buttons doen't fit in the whole screen, but instead i find some vacant space in the bottom.

So, how can i arrange those buttons, in such a way that, they all fit in the any kind/size of screen properly, without leaving any extra space. (regardless of the different screensize of mobile)
i hope you understand what i mean....

thanx in advance..

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kumarv75
Offline
Joined: 2010-06-08

Hi nisha_dh

So then in that case use getDisplayWidth() to get the width and getDisplayHeight() to get the height , then set the width and height that u got to the place where u need ...................:-)

nisha_dh
Offline
Joined: 2010-07-30

thanx for hte reply,.
i tried the way you mentioned,.its better than before but now its taking more space than the height of the screen,. ie. i hav to scroll down a bit to see the content in the bottom. I am using image as a button., may be thts causing hte problem. I tried to scale the height of the image by:

Button thumbsUp = new Button("Thumbsup", t_up);//t_up is an image
t_up.scaledHeight(button_height);
it wud be nice to have all the contents in the screen without the need of scrolling...

And also, how can we detect the screen orientation in LWUIT?
Any sugesstions please...

myinstinct
Offline
Joined: 2008-10-24

try scaling the image before creating the button

more specifically

[code]
Button thumbsUp = new Button("Thumbsup", t_up.scaledHeight(button_height));
[/code]

Message was edited by: myinstinct

nisha_dh
Offline
Joined: 2010-07-30

hiii,
thanx for the solution..its workin better now:)