Hi I'm working on a application which asks for OTP when user want to reset his password for which I need a text like the one in attached Image... What I thought to proceed with is individual text for each of the letter, All of them arranged in linear layout of horizontal orientation with some margin... and max length as 1 so only one letter can be entered in each editText... Is that a right Approach?? Any Suggestions??
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
You can make a custom Editext and add it in your xml file, find below a custom class
For reference check below link
https://madoverandroid.wordpress.com/2017/07/11/edittext-with-separate-box-for-each-letter-customentryedittext/
You can try this, by making TextWatcher more Generic, so its easy to use and understand
Use below class:
How to use above class
Here et1,et2,et3 and et4 are your EditTexts, I know its bad naming convention as per Java Standard, but you can replace it with yours.
P.S You can find the xml design for this here GitHub some other, sample design xml for reference
Use 4 different EditText.Use the below code to change the focus after subsequent entry.
and so on...
Concatenate the text from all the EditText.
You can try this if you want to add some extra logic for delete the OTP, i create it based on the answer from A.R. make sure you set
maxlength = 2
for all edittext