I will give you only an idea, so the implementation is up to you. Create your TextWatcher in
onTextChanged()
Count how many digits the user has written and, depending on this number, create a line filled with zeros. After that, make zeros of a different color
Spannable textWithTintedZeros = new SpannableString(paddedString); textWithTintedZeros.setSpan(new ForegroundColorSpan(yourGrey), firstZeroIndex, length, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); editText.setText(textWithTintedZeros);
And finally set the choice to zeros with
editText.setSelection(indexBeforeFirstZero);
Remember to also block changing the position of the cursor. I think it can be done with
View.OnKeyListener
source share