Text Input Layout for Sign up and Sign in Android.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SignUpActivity">

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txt_hello"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.2"
app:layout_constraintHeight_percent="0.06"
android:gravity="center"
android:text="@string/hello"
android:textColor="#3F51B5"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txt_signup"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center"
android:text="Sign Up!"
android:textColor="#3F51B5"
android:textSize="32sp"
android:textStyle="bold"
app:layout_constraintHeight_percent="0.1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_hello"
app:layout_constraintWidth_percent="0.4" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/txtLay_username"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.9"
app:layout_constraintHeight_percent="0.1"
android:hint="USERNAME"
app:endIconMode="clear_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="0.3">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/txtInput_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLength="20" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/txtLay_emailAdd"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.9"
app:layout_constraintHeight_percent="0.1"
android:hint="@string/email_address"
app:endIconMode="clear_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="0.4">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/txtInput_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLength="20" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/txtLay_pass_signup"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.9"
app:layout_constraintHeight_percent="0.1"
android:hint="PASSWORD"
app:endIconMode="password_toggle"
app:endIconDrawable="@drawable/ic_lock"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtLay_emailAdd">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/txt_pass"
android:inputType="textPassword"
android:maxLength="15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>


<!--switchCompact layout direction right is used for switching the text in right direction.-->
<!--TextAllCaps is used for capitalization-->

<androidx.appcompat.widget.SwitchCompat
android:id="@+id/sh_remember"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center"
android:layoutDirection="rtl"
android:text="@string/i_accept_the_policy_and_terms"
app:layout_constraintHeight_percent="0.06"
app:layout_constraintTop_toBottomOf="@id/txtLay_pass_signup"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintVertical_bias="0.8"
app:layout_constraintHorizontal_bias="0.9"
app:layout_constraintWidth_percent="0.7"
/>

<com.google.android.material.button.MaterialButton
android:id="@+id/btn_signup"
style="@style/Widget.MaterialComponents.Button"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHeight_percent="0.07"
app:layout_constraintWidth_percent="0.5"
android:background="@drawable/shape"
android:text="Sign up"
android:textSize="16sp"
android:textAllCaps="false"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.7"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHeight_percent="0.08"
app:layout_constraintWidth_percent="0.6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="0.8"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="8dp"
app:srcCompat="@drawable/ic_googleplus"
/>

<ImageView
android:id="@+id/imageView2"
android:layout_width="40dp"
android:padding="8dp"
android:layout_height="40dp"
app:srcCompat="@drawable/ic_linkedin"
/>

<ImageView
android:id="@+id/imageView3"
android:padding="8dp"
android:layout_width="50dp"
android:layout_height="50dp"
app:srcCompat="@drawable/ic_twitter"
/>
</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
Signup activity UI.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".LoginActivity">

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txt_welcome"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.5"
app:layout_constraintHeight_percent="0.06"
android:gravity="center"
android:text="@string/welcome_back"
android:textColor="#3F51B5"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txt_reg"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center"
android:text="@string/log_in"
android:textColor="#3F51B5"
android:textSize="32sp"
android:textStyle="bold"
app:layout_constraintHeight_percent="0.1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txt_welcome"
app:layout_constraintWidth_percent="0.4" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/txtLay_user"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.9"
app:layout_constraintHeight_percent="0.1"
android:hint="@string/email_address"
app:endIconMode="clear_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="0.4">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/txtInput_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLength="20" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/txtLay_pass"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.9"
app:layout_constraintHeight_percent="0.1"
android:hint="PASSWORD"
app:endIconMode="password_toggle"
app:endIconDrawable="@drawable/ic_lock"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtLay_user">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/txt_pass"
android:inputType="textPassword"
android:maxLength="15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txt_forPassword"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center"
app:layout_constraintWidth_percent="0.4"
app:layout_constraintHeight_percent="0.06"
android:text="@string/forgot_password"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtLay_pass"/>

<!--switchCompact layout direction right is used for switching the text in right direction.-->
<!--TextAllCaps is used for capitalization-->

<androidx.appcompat.widget.SwitchCompat
android:id="@+id/sh_remember"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center"
android:layoutDirection="rtl"
android:text="@string/remember_me"
app:layout_constraintHeight_percent="0.06"
app:layout_constraintTop_toBottomOf="@id/txtLay_pass"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintVertical_bias="0.8"
app:layout_constraintHorizontal_bias="0.9"
app:layout_constraintWidth_percent="0.4"
/>

<com.google.android.material.button.MaterialButton
android:id="@+id/btn_login"
style="@style/Widget.MaterialComponents.Button"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHeight_percent="0.07"
app:layout_constraintWidth_percent="0.5"
android:background="@drawable/shape"
android:text="@string/login"
android:textSize="16sp"
android:textAllCaps="false"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.8"
/>


</androidx.constraintlayout.widget.ConstraintLayout>
Login Activity UI.

--

--

--

Android Developer || WomenTech Global Ambassador at WomenTech Network. || Yoga Teacher || Member @WTM .

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Evolution of Android Network Access

Smoothen jagged edges of rotated image view

The Wrong, Hacked, and Correct way of Android Deep Linking for Redirected MultiSite with AutoVerify

Notification in Android Kotlin.

Android P — What’s new (summary)

Android 12: Splash Screens

Learn All Android Canvas Draw Functions

7 ways to null crash Android Kotlin without using !!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Harshita Bambure

Harshita Bambure

Android Developer || WomenTech Global Ambassador at WomenTech Network. || Yoga Teacher || Member @WTM .

More from Medium

Relationships in Realm

Android Fundamentals : Content Provider

Root Android device Pixel 6