Implementing ATM Numeric input behaviour in Androi

2019-09-19 10:17发布

How can I implement the following input behaviour using EditText in Android. Is there a existing library to implement this behaviour or if else, what would the logic be like? This behaviour can be seen on ATM machines as well.

Here's a gif that demonstrates this behaviour in an Android app:

enter image description here

As observed, the input starts with the last digit and proceeds to the left while appending necessary commas and decimal separation (2 decimals). I couldn't find any library that implements this behaviour.

Can you point me in the right direction with an existing implementation or a library?

1条回答
你好瞎i
2楼-- · 2019-09-19 10:23

I resolved this and built a custom library based on Subhechhu Khanal's link to a resolved thread. Anyone who needs this behaviour can use the custom library and customise it as required.

ATM-EditText Library: https://github.com/dinukapj/ATM-EditText

I encourage the community to make this library better. Thanks!

查看更多
登录 后发表回答