TransformationMethod type=edit2.getTransformationMethod();
if (PasswordTransformationMethod.getInstance().equals(type)) {
edit2.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
imb1.setImageResource(R.drawable.black);
} else {
edit2.setTransformationMethod(PasswordTransformationMethod.getInstance());
imb1.setImageResource(R.drawable.blue);
在监听器的内部加上这部分代码就可以了
希望能帮到你