private voidchangPwdEditTextStatus() {
//TODO 判断标记是否存在
booleanflag = (mEtPassword.getTag() ==null);
//TODO 设置EditText文本为可见的 或 不可见
mEtPassword.setTransformationMethod(flag ? HideReturnsTransformationMethod.getInstance() : PasswordTransformationMethod.getInstance());
//TODO 设置标记
mEtPassword.setTag(flag ?"":null);
//TODO 切换后将EditText光标置于末尾
CharSequence charSequence =mEtPassword.getText();
if(charSequenceinstanceofSpannable) {
Spannable spanText = (Spannable) charSequence;
Selection.setSelection(spanText,charSequence.length());
}
}
网友评论