Types of layouts in android
A layout in Android is a class that defines the visual structure of User Interface, especially View objects like widgets, activity apps, buttons, text fields and other objects on screen. Inside of View class there is ViewGroup where is all of UI properties for child layout objects.
There is five types of layouts in android. It is Linear Layout, Table Layout Absolute Layout, Relative Layout and Frame Layout.
Linear Layout
This is one of the basic layout in Android. It work simple – display objects as a single line. That line can be vertically or horizontally. When you add objects on screen, they will be display on a single direction, you only need to specify in which – vertical or horizontal.
Table Layout
With this layout, you can organize your objects in the table. You specify number of rows and columns and put your objects there like you want. Just need to be careful, because the number of your columns must be equal for all rows.
Absolute Layout
This layout allows absolute positioning of objects on the screen. This means that you can freely determine where objects should be. You can specify the exact X and Y coordinates of objects on the screen as you like. You must be careful with this type, because with it you can make mess on your screen if you are not good UI designer.
Relative Layout
As a name suggest, objects in this layout are positioning relative to each other. There is several ways to do this and all of them is about relationships between objects, parents and container. The one object can be left, right, below and above of other object or aligned by the left, right, bottom and top of edge of other object or a parent. Also it can be centered vertically, centered horizontally or centered vertically and horizontally relative to its parent.
Frame Layout
With Frame Layout you can display only a single object on the screen. So what happen with a lot of objects? If you have a multiple objects within this layout and they are overlapping, it will display like that.
This is bacis of layouts in Android. There is much more things that you can do with your screen in Android, but you can make combination of this layouts to design your screen as you like. There is number of thing that you do with them, so go on, experiment with layouts in android to make your User Interface the best you can do.