I specify EditText

 android:inputType="textPassword" 

How to increase the size of the points behind which the password is EitText in EitText without changing the text size?

  • About the increase is not sure, but the dot symbol (.) can for example be replaced with an asterisk (*) - ermak0ff
  • @ ermak0ff I saw an opportunity to replace it, but I need to increase it - iamtihonov
  • Well, replace with an enlarged point - (•))) - ermak0ff
  • @ ermak0ff interesting offer, I will try - iamtihonov
  • one
    Well, if out of all the available characters, you didn’t find the only one that will fit the design, then you probably need to create your own twist and draw on the canvas.

1 answer 1

EditText has a setTransformationMethod() method

To which we pass an instance of this class:

 private class MyPasswordTransformationMethod extends PasswordTransformationMethod { @Override public CharSequence getTransformation(CharSequence source, View view) { return new PasswordCharSequence(source); } private class PasswordCharSequence implements CharSequence { private CharSequence mSource; public PasswordCharSequence(CharSequence source) { mSource = source; } public char charAt(int index) { return '●'; } public int length() { return mSource.length(); } public CharSequence subSequence(int start, int end) { return mSource.subSequence(start, end); } } } 

Actually the most interesting thing here is in the charAt method:

 public char charAt(int index) { return '●'; } 

Which returns the character that will display the entered character of the password.

Total with PasswordTransformationMethod data:

enter image description here

Default behavior: enter image description here

  • Unfortunately, for me this character is too large. Tried '•', '●', '.', And some other. - iamtihonov