Translate

Thursday, 18 February 2016

Android Layout Types

There are number of Layouts provided by Android which you will use in almost all the Android applications to provide different view, look and feel.
Sr.NoLayout & Description
1Linear Layout
LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally.
2Relative Layout
RelativeLayout is a view group that displays child views in relative positions.
3Table Layout
TableLayout is a view that groups views into rows and columns.
4Absolute Layout
AbsoluteLayout enables you to specify the exact location of its children.
5Frame Layout
The FrameLayout is a placeholder on screen that you can use to display a single view.
6List View
ListView is a view group that displays a list of scrollable items.
7Grid View
GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid.

Layout Attributes

Each layout has a set of attributes which define the visual properties of that layout. There are few common attributes among all the layouts and their are other attributes which are specific to that layout. Following are common attributes and will be applied to all the layouts:
AttributeDescription
android:idThis is the ID which uniquely identifies the view.
android:layout_widthThis is the width of the layout.
android:layout_heightThis is the height of the layout
android:layout_marginTopThis is the extra space on the top side of the layout.
android:layout_marginBottomThis is the extra space on the bottom side of the layout.
android:layout_marginLeftThis is the extra space on the left side of the layout.
android:layout_marginRightThis is the extra space on the right side of the layout.
android:layout_gravityThis specifies how child Views are positioned.
android:layout_weightThis specifies how much of the extra space in the layout should be allocated to the View.
android:layout_xThis specifies the x-coordinate of the layout.
android:layout_yThis specifies the y-coordinate of the layout.
android:layout_widthThis is the width of the layout.
android:layout_widthThis is the width of the layout.
android:paddingLeftThis is the left padding filled for the layout.
android:paddingRightThis is the right padding filled for the layout.
android:paddingTopThis is the top padding filled for the layout.
android:paddingBottomThis is the bottom padding filled for the layout.

No comments:

Post a Comment