------ Solution --------------------------------- -----------
can customize as * , the disadvantage is the input characters are displayed directly as * , rather than show the original characters over one second after the change * .
editText.setTransformationMethod(new AsteriskPasswordTransformationMethod());
class AsteriskPasswordTransformationMethod 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
}
}
}
------ For reference only ----------------------------------- ----
inputType = "textpassword"
------ For reference only ------------------------- --------------
this property is set , the display yes. . . . .
------ For reference only -------------------------------------- -
tantahe Thank you very much !
没有评论:
发表评论