how to put 4 button in row, as in the picture:
The distance between the elements should be changed at different resolutions
how to put 4 button in row, as in the picture:
The distance between the elements should be changed at different resolutions
Play with setMargin(Component.RIGHT,x)
for the first three Buttons. Set the value of x
such that the Buttons are equi-partitioned in the row : you must take into account the preferredWidth of the Buttons for that
. For the first Button set its margin-left to 0 ( setMargin(Component.LEFT,0)
) , and for the last Button set its right-margin to 0 ( setMargin(Component.RIGHT,0)
).
There are allot of ways to do everything in LWUIT. Its unclear from your image what your exact constraints are, I'm guessing you want the left most button to be left aligned and the right most to be right aligned. You probably also want the two other buttons to be centered.
I would implement this using a
GridLayout
with nestedFlowLayout
elements. As such: