Search code examples
androidandroid-edittextandroid-themeandroid-styles

How to make custom input pin code Android?


I make project on Kotlin Android. How can i make the same field and same input? It seems to me creating a few edittexts is not good decision enter image description here

enter image description here

Now i have this decision

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="16dp"
        android:hint="_ _ _ _ _ _"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:textSize="14sp"
        android:fontFamily="@font/stolzl_regular"
        android:gravity="center"
        android:inputType="number"
        android:letterSpacing="0.12"
        android:maxLength="6"
        android:background="@drawable/custom_input_number"/>

but it doesn't work how i heed


Solution

  • You will need to research market for a library which will do this work for you. AndroidArsenal or github.com are good places to start.

    If you will not find a good library within an hour or two, you will have to implement a custom component. Android has a good documentation on how to do this