Monday, April 14, 2014

EditText of inputType = "true" now shows ... how to display ***


More anxious, seeking expert help ah
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
inputType = "textpassword"
Reply:
cited landlord liangjixunx reply:
more anxious, seeking expert help ah
After setting this property, displays yes. . . . .
Reply:
* You can customize the disadvantage is displayed directly as input characters *, not show the original characters after passing second becomes *.
 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
}
}
}

Reply:
tantahe Thank you very much!

No comments:

Post a Comment