Search code examples
androidandroid-edittextandroid-inputtype

How to increase inputType password dot size in android


I have an EditText whose inputType is numberPassword. I want to change the dot size which replaces the text. It is quite small(android default) for my purpose. I want to increase the dot size. How can I achieve that ?


Solution

  • Try to replace asterisk with this ascii codes.
    ⚫ - ⚫ - Medium Black Circle ⬤ - &#11044 - Black Large Circle

    What would be the Unicode character for big bullet in the middle of the character?

     public 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; // Store char sequence
            }
            public char charAt(int index) {
                return '*'; // This is the important part
            }
            public int length() {
                return mSource.length(); // Return default
            }
            public CharSequence subSequence(int start, int end) {
                return mSource.subSequence(start, end); // Return default
            }
        }
    }; 
    
    text.setTransformationMethod(new MyPasswordTransformationMethod());