'How to make a view that is like EditText for SMS code validation? [closed]

I want to add multiple inline EditText in my Android application where user can enter text and then the next EditText gets the focus automatically. Like in the image below. I want a sample code (or a library) on how to achieve it.enter image description here



Solution 1:[1]

You can use below libraries:

or building it using this tutorial

Solution 2:[2]

There's one more library in addition to the ones already mentioned here - SmsConfirmationView

Solution 3:[3]

I also came across this one, and it is quite customizable

VerificationCodeInputView

For instance

<com.wynsbin.vciv.VerificationCodeInputView
    android:id="@+id/verification_code"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="48dp"
    android:gravity="center"
    android:orientation="horizontal"
    app:vciv_et_background="@android:color/white"
    app:vciv_et_foucs_background="@android:color/holo_orange_dark"
    app:vciv_et_cursor_color="@color/colorPrimary"
    app:vciv_et_height="58dp"
    app:vciv_et_inputType="number"
    app:vciv_et_number="6"
    app:vciv_et_text_color="@android:color/black"
    app:vciv_et_text_size="18sp"
    app:vciv_et_underline_default_color="@android:color/holo_green_dark"
    app:vciv_et_underline_focus_color="@android:color/holo_blue_bright"
    app:vciv_et_underline_height="2dp"
    app:vciv_et_underline_show="true"
    app:vciv_et_width="58dp" />

After adding the repo in your root build.gradle file

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

You can add the dependency like this

implementation 'com.github.Wynsbin:VerificationCodeInputView:1.0.2'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 salmanseifian
Solution 2 fraggjkee
Solution 3