本文档为个人博客文档系统的备份版本、作者:小游、作者博客:点击访问
参考: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());