Otp verification screen design in android

OTP Verification screen design in android studio using XML CODE

Dependency: implementation 'com.airbnb.android:lottie:3.3.1'

//Button Design Res>Drawable

btn_verifiy_otp_design.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">

    <gradient
        android:startColor="#E65758"
        android:endColor="#771D32"
        android:type="linear"
        android:angle="45"
        />
    <corners android:radius="50dp"/>


</shape>
Follow Below Code:

<?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:id="@+id/layout_otp_verification"
    android:layout_height="match_parent"
    tools:context=".OtpVerivicationScreen">

    <com.airbnb.lottie.LottieAnimationView
        android:id="@+id/animation_view"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:layout_centerInParent="true"
        android:layout_margin="10dp"
        android:background="@android:color/transparent"
        android:scaleType="fitCenter"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:lottie_autoPlay="true"
        app:lottie_fileName="phoneverificationsuccess.json"
        app:lottie_loop="true" />

    <TextView
        android:textColor="@android:color/black"
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="@font/cerapro_bold"
        android:padding="15dp"
        android:text="OTP Verification"
        android:textAlignment="center"
        android:textSize="30sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/animation_view" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="@font/cerapro_light"
        android:padding="10dp"
        android:text="You will get a OTP via SMS"
        android:textAlignment="center"
        android:textSize="17sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView2">

        <LinearLayout
            android:layout_marginStart="20dp"
            android:layout_marginEnd="20dp"
            android:orientation="vertical"
            android:gravity="center"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintTop_toBottomOf="@+id/textView2">


            <EditText
                android:id="@+id/editText_enter_otp"
                android:hint="Enter Your OTP"
                android:textAlignment="center"
                android:maxLength="6"
                android:inputType="number"
                android:fontFamily="@font/cerapro_bold"
                android:textSize="20sp"
                android:padding="15dp"
                android:background="@drawable/textbox_for_otp_code"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

            <androidx.appcompat.widget.AppCompatButton
                android:id="@+id/btn_verifiy_otp"
                android:elevation="6dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:background="@drawable/btn_verifiy_otp_design"
                android:fontFamily="@font/cerapro_medium"
                android:padding="15dp"
                android:text="VERIFIY"
                android:textAllCaps="false"
                android:textColor="@android:color/white"
                android:textSize="18sp" />

        </LinearLayout>
    </ScrollView>


</androidx.constraintlayout.widget.ConstraintLayout>


Otp verification screen design in android using xml code

You may like these posts