Android Application layouts
Android Application layouts help to organize the many more components in an efficient way. If you are new to android application development get to learn more about Android & Android studio.
The layouts are present in Android Studio, the layouts are written in XML format. By using Android Studio, we can add or modify components in two ways.
There are two ways
1. Using XML
2. Using Drag & Drop (Graphical way)
Which way is better for UI Development?
In Android studio you are completely strong in both of these ways. There is no more option to choose. You can use both ways; you can develop perfect UI applications.
Before diving to UI development, you must learn about Android Layouts.
Layouts are
- Constraint Layout
- Linear Layout (Horizontal & Vertical)
- FrameLayout
- TableLayout
- TableRow
- Relative Layout
- Grid Layout
1. Constraint Layout
Constraint layouts are similar to relative layouts. Constraint layout can allow you to create a complex layout with a flat view hierarchy. The constraint layouts are entirely different from other layouts. Constraint layouts are only drag and drop instead of editing XML.
2. Linear Layout
Linear layouts is a view group, it can be aligning all children in a single direction. There are two directions in linear layout [Horizontal] or [Vertical]. All child components are stacked one after another one.
Vertical direction has one child per row
Horizontal direction has one row high.
Linear Layout respects margins between children & gravity. Alignment (right, centre & left alignment) for each child.
3. Frame Layout
Frame Layout is designed to block an area on the screen to display a single item. Frame Layouts are holding a screen view, because it can be difficult to organize child views in a way that`s scalable to different screen sizes without the children overlapping.
4. Table Layout
Table Layout allows going to be arranged groups of views into rows & columns. You will use the <TabeRow> element to build a row in the table. Each row has Zero or more cells.
5. Table Row
A Layout arranges its children in a horizontal position. A Table Row should always be used as a TableLayout. The children of a TableRow do not need to specify the layout_width and layout_height attributes in the XML file.
6. Relative Layout
In earlier days Relative layout was very special for every developer, easy to align the children's at any place. Main drawback of Relative Layout is not being responsible for different screen sizes. Today Constraint Layout replaced the Relative layout.
7. Grid Layout
Grid Layout offers a two dimensional scrolling grid (rows & columns) and the grid items are not necessarily pre-determined but they are automatically inserted to the layout using a list adapter.
