RelativeLayout
class is a layout manager that lays out a container's components on the specified X or Y axis. Components can be layed out at their preferred size or at a relative size. When relative sizing is used the component must be added to the container using a relative size constraint, which is simply a Float value. The space available for relative sized components is determined by subtracting the preferred size of the other components from the space available in the container. Each component is then assigned a size based on its relative size value. For example: container.add(component1, new Float(1)); container.add(component2, new Float(2)); There is a total of 3 relative units. If the container has 300 pixels of space available then component1 will get 100 and component2, 200. It is possible that rounding errors will occur in which case you can specify a rounding policy to use to allocate the extra pixels. By defaults components are center aligned on the secondary axis however this can be changed at the container or component level.
|
|