My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
LinearLayout  
A Layout that arranges its children in a single column or a single row.
Updated Dec 20, 2009 by tom.verg...@gmail.com

Description

A 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

Example

public 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"));
	}
}
Powered by Google Project Hosting