chap3mad linear
chap3mad linear
UI COMPONENTS AND
LAYOUTS
UI Layouts
2. wrap_content
fill_parent_width
change the “layout_width” to “fill_parent” now the
LinearLayout −
1. android:id
This is the ID which uniquely identifies the layout.
2. android:baselineAligned
This must be a boolean value, either "true" or
<Button android:id="@+id/btnStartService"
android:layout_width="270dp"
android:layout_height="wrap_content"
android:text="start_service"/>
<Button android:id="@+id/btnPauseService"
android:layout_width="270dp"
android:layout_height="wrap_content"
android:text="pause_service"/>
<Button android:id="@+id/btnStopService"
android:layout_width="270dp"
android:layout_height="wrap_content"
android:text="stop_service"/>
</LinearLayout>
Relative Layout
RelativeLayout is a view group that
displays child views in relative positions.
Android RelativeLayout enables you to
specify how child views are positioned
relative to each other. The position of
each view can be specified as relative to
sibling elements or relative to the
parent.
RelativeLayout Attributes
Following are the important attributes specific to
RelativeLayout −
1. android:id
This is the ID which uniquely identifies the layout.
2. android:gravity
This specifies how an object should position its
gravity.
Using RelativeLayout, you can align two elements by
right border, or make one below another, centered in
the screen, centered left, and so on. By default, all
child views are drawn at the top-left of the layout, so
you must define the position of each view using the
various layout properties available from
RelativeLayout.LayoutParams and few of the
important attributes are given below −
1. android:layout_above
Positions the bottom edge of this view above the given
anchor view ID and must be a reference to another
resource, in the form "@[+][package:]type:name"
2. android:layout_alignBottom
Makes the bottom edge of this view match the