如何在android中增加inputType密码点大小

前端之家收集整理的这篇文章主要介绍了如何在android中增加inputType密码点大小前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个EditText,其inputType是numberPassword.我想更改替换文本的点大小.它对我来说非常小( android默认).我想增加点大小.我怎样才能做到这一点?

解决方法

尝试用这个ascii代码替换星号.
⚫ – ⚫ – 中黑圈
⬤ – &#11044 – 黑色大圆圈

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());

猜你在找的Android相关文章