https://kotlinlang.org logo
#compose
Title
# compose
j

József Szilvási

10/22/2020, 12:13 PM
Hey, I want to create a simple OTP/PIN layout, any ideas how to do it easily? Jumping one TextField to another doesn't seem like a pretty solution to me, but I have no other idea ATM.
s

Se7eN

10/22/2020, 2:09 PM
What do you mean by jumping one TextField from another?
j

József Szilvási

10/22/2020, 3:46 PM
s

Se7eN

10/22/2020, 4:55 PM
Multiple TextFields seems like a good solution to me. As far as I know, that's how it was achieved in the view system too
j

Jeisson Sáchica

10/22/2020, 5:27 PM
Actually I think most OTP/PIN layout libraries in the classic view system use a single field by extending the EditText class. Ex: https://github.com/ChaosLeung/PinView/blob/master/pinview/src/main/java/com/chaos/view/PinView.java
👌 3
s

Se7eN

10/22/2020, 5:53 PM
Oh thanks for letting me know
d

Daniele Segato

11/20/2022, 5:04 PM
@József Szilvási did you find a solution? Care to share how did you do it?
j

József Szilvási

11/22/2022, 12:52 PM
I went with a very simple solution. I put a transparent TextField on top of the digit fields and filling them according to the Textfield input. https://gist.github.com/naturlecso/132ad768521533357b234f1784144f51