A walkthrough to layout views in Android
FrameLayout
Its an layout for a single object an image for example. Children of an FrameLayout get automatically positioned at the top-left of the layout. This is not possible to change.
If there are more than one child there will be only one visible, the first.
LinearLayout
The most common view. This view has two modes to display its children – horizontal or vertical, one child per row or column if you think like a list (1 row)
TableLayout
As it sounds its a table of cell that you split the children into rows and columns. TableRow descripes the row and the biggest amount of children in a row sets the amount of total columns.
RelativeLayout
RelativeLayout lets the children be relative to each other, by declaring layoutabove=”id” or layoutbelow=”id” can you decide the position of the child, if you use both it will ly in between those two elements
Some attributes to consider that one can enter the on children
Note! Some layouts do not take into account all of the attributes.
Weight - the degree of importance as regards the filling of the parent. The higher the weight the more the right to place. Several children at the same weight are equally important. Logical but to consider is that if a child has two in weight and two children have a weight as a child entitled to 50% of the excess surface and two children will share the rest. Can be a little math if there are many children.
Margin - The distance between the child and nothing else.
Gravity - What the child should be adjusted to the row / column. Up, down, left, right, or a combination.
Padding - the distance between the child’s contents and the outer edge of the baby.