Create the below form using Relative Layout.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".MainActivity">
<TextView
android:id="@+id/t1"
android:text="Sign In"
android:textSize="30dp"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView
android:id="@+id/t2"
android:text="Username:"
android:textSize="25dp"
android:layout_below="@id/t1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginLeft="20dp"/>
<EditText
android:id="@+id/e1"
android:hint="Enter the Username"
android:textSize="25dp"
android:layout_toRightOf="@id/t2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignBaseline="@id/t2"
android:layout_marginLeft="20dp" />
<TextView
android:id="@+id/t3"
android:text="Password:"
android:textSize="25dp"
android:layout_below="@id/t2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginLeft="20dp"/>
<EditText
android:id="@+id/e2"
android:hint="Enter the Password"
android:textSize="25dp"
android:layout_toRightOf="@id/t3"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignBaseline="@id/t3"
android:layout_marginLeft="20dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/e2"
android:layout_marginLeft="-99dp"
android:layout_marginTop="37dp"
android:layout_toRightOf="@id/e2"
android:text="Sign In"
android:textSize="25dp" />
</RelativeLayout>
Output:
Comments
Post a Comment