|
LinearLayout
A Layout that arranges its children in a single column or a single row.
DescriptionA Layout that arranges its children in a single column or a single row. The direction of the row can be set by calling setOrientation(). You can also specify gravity, which specifies the alignment of all the child elements by calling setGravity(). The default orientation is horizontal. This layout will resize itself depending on its content. Inspired by http://developer.android.com/reference/android/widget/LinearLayout.html Examplepublic class TestScene extends Scene2D
{
@Override
public void load()
{
LinearLayout layout = new LinearLayout();
add(layout);
layout.setOrientation(Orientation.HORIZONTAL);
// sets the position of the elements inside the layout container
layout.setGravity(0.5, 0.5);
// sets the spacing around the element
layout.padding.set(50);
// sets the spacing between the elements
layout.childMargin.set(5);
// Add 2 buttons to the layout
layout.add(ButtonFactory.createLabeledButton("First button"));
layout.add(ButtonFactory.createLabeledButton("Second button"));
}
}
|