Introduction to Layout-Relative Layout
Relative layout is the another type of layout in android.and in relative layout the widgets are placed according to the parent position.
following are some of the relative layout samples
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/relative"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/t1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="User Name"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">
</TextView>
<EditText
android:id="@+id/e1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/t1"
android:layout_alignParentLeft="true"
android:layout_alignLeft="@+id/relative"
android:padding="20dip">
</EditText>
<Button
android:id="@+id/btnGo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/e1"
android:layout_alignRight="@+id/e1"
android:text="Submit"
android:textStyle="bold">
</Button>
</RelativeLayout>
No comments:
Post a Comment