版权声明:为中华之崛起而读书。转载请注明出处: https://blog.csdn.net/Kj_Gym/article/details/82766860
核心代码:
// 显示密码
passwordText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
// 隐藏密码
passwordText.setTransformationMethod(PasswordTransformationMethod.getInstance());
一般设置完后,光标会定位到密码输入框的首位。需要定向到末尾:
passwordText.setSelection(passwordText.getText().toString().length());