Android Provides few layouts for structure user interface such a Linear,Relative,Grid,Table,Frame layouts
by default main activity contains Relative layout, Relative layout provides advantage is
we can place our components/views like one another other, one below another. however we need, but we need to specify with respect another view or parent.
Relative layout is good customized layout for all our components/views.
1. Place view center of the relative layout.
andriod:layout_centerInParent, Vertical,Horizontal---are true/false /
In Java[ Center_IN_Parent, Center_Vertical, Center_Horizontal].
2. Alignment between view with its parent edge:
android:layout_alignParentTop // ALIGN_PARENT_TOP
android:layout_alignParentButtom // ALIGN_PARENT_BUTTOM
android:layout_alignParentLeft // ALIGN_PARENT_LEFT
android:layout_alignParentRight // ALIGN_PARENT_RIGHT
3. Alignment between the views using
android:layout_above
android:layout_below
android:layout_toLeftOf
android:layout_toRightOf
android:layout_below="@id/textView1" ----then button is place below the textview control.
4. Define alignment between 2 views
android:layout_alignTop/Button,Left,Right,Baseline.
Relative layout doesn't provides weight and gravity properties to align them like linear layout.
Linear layout : by placing views and specifing weight to same value, all views has same size or width. linear layout can be horizontal or vertical.
Gridlayout: which has rowscount and columcount values to specify the size of Gird.
Grid lines are reference with indices, based on our need we will place them in respective cells/rows in the grid layout.
Framelayout is place holder for view or viewgroup.in this also all views are bydefault place to top left. using gravity enum we can specify : center,right,left.
Tablelayout to represent the views in table format.
No comments:
Post a Comment