{{docContent.title}}

密码框否可见

参考:https://segmentfault.com/a/1190000010416124

最终代码如下:

if(imgEye.getText()==mcontext.getString(R.string.post_img_view)){
    editPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
    imgEye.setText(mcontext.getText(R.string.login_no_eye));
}else{
    imgEye.setText(mcontext.getText(R.string.post_img_view));
    editPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
//设置光标位置
editPassword.setSelection(editPassword.getText().toString().length());