Post on 14-Aug-2015
In this Section
• Introduction to Layouts in Android• Types of Layouts
Layouts in Android
Layouts in Android
• Layouts define the arrangement of views.
• Android layouts are defined mostly in XML.
• Various properties of Layouts can be set using XML attributes.
Layouts in Android
Types Of Layout
• LinearLayout• RelativeLayout• FrameLayout• TableLayout
Layouts in Android
LinearLayout Used to align views horizontally or
vertically. Use android:orientation attribute to
define the orientation.
LinearLayout
LinearLayout Example
Examples
RelativeLayout
Used to arrange views in positions relative to other views or Parent Views/layouts.
Relative Layout attributes layout:toLeftOf layout:toRightOf layout:below layout:above layout:alignParentTop layout:alignParentBottom layout:alignParentLeft layout:alignParentBottom
and more…….
FrameLayout Used to display Single child view. It is useful when we have to display a
single item so that it scales properly in different screen sizes.
TableLayout Used to arrange views in rows and
columns TableRow element can be used to define
rows. android:layout_span attributes is used
to span views across columns
TableLayout Example
Thanks.
Find Complete Code at.
https://github.com/technoguff/Layouts-in-Android
And, Tutorial at
http://blog.technoguff.com/2015/07/layouts-in-android.html