There is a number of Layouts provided by Android which you will use in almost all the Android applications to provide a different view, look and feel.
- Linear Layout - LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally. Linear layout is used to place one element on each line. So, all the elements will be placed in an orderly top-to-bottom fashion.
- Relative Layout - RelativeLayout is a view group that displays child views in relative positions. Using relative layout, we can specify the position of the elements in relation to other elements, or in relation to the parent container.
- Table Layout - TableLayout is a view that groups view into rows and columns.
- Absolute Layout - In AbsoluteLayout we can specify the exact coordinates of each control that we want to place. In absolute layout, we will give the exact X and Y coordinates of each control.
- Frame Layout - It is used when you want to show one item on each screen.
- List View - ListView is a view group that displays a list of scrollable items. Displays a scrolling single column list.
- Grid View - GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid.Displays a scrolling grid of columns and rows.
Android Layout Attributes
- android: id - This is the ID which uniquely identifies the view
- android: layout_width - This is the width of the layout
- android: layout_height - This is the height of the layout
- android: layout_margin - This is the extra space outside of the view. For example, if you give android: marginLeft="20dp", then the view will be arranged after 20dp from left
- android: layout_padding - This is similar to android:layout_margin except that it specifies the extra space inside the view
- android: layout_gravity - This specifies how child Views are positioned
- android: layout_weight - This specifies how much of the extra space in the layout should be allocated to the view
- android: layout_x - This specifies the x-coordinate of the layout
- android: layout_y - This specifies the y-coordinate of the layout
Stay tuned for more detailed articles
- Aswin Bhim Nath
Comments
Post a Comment