Relative layout example in android
main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/myRelativeLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff000000"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/lblUserName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffff0066"
android:text="User Name"
android:textStyle="bold"
android:textColor="#ff00ff00"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">
</TextView>
<EditText
android:id="@+id/ediUserName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lblUserName"
android:layout_alignParentLeft="true"
android:layout_alignLeft="@+id/myRelativeLayout"
android:padding="20dip">
</EditText>
<Button
android:id="@+id/btnGo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ediUserName"
android:layout_alignRight="@+id/ediUserName"
android:text="Go"
android:textStyle="bold">
</Button>
<Button
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/btnGo"
android:layout_below="@+id/ediUserName"
android:text="Cancel"
android:textStyle="bold">
</Button>
</RelativeLayout>
output
example output |
No comments:
Post a Comment