开发中遇到了这个问题,特此记录下。
效果图:
代码:
[代码]java代码:
if (!isshowpwd) {
isshowpwd = true;
etNormalPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
} else {
//否则隐藏密码
isshowpwd = false;
etNormalPwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
[代码]java代码:
etNormalPwd.setSelection(getTV(etNormalPwd).length());
[代码]java代码:
public String getTV(TextView tv) {
return tv == null ? "" : tv.getText().toString();
}