在xml中设置edittext属性android:password="true"
在java中
if (!mbDisplayFlg) {
// display password text, for example "123456"
et_password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
} else {
// hide password, display "."
et_password.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
mbDisplayFlg = !mbDisplayFlg;
et_password.postInvalidate();
本文介绍了如何在XML布局文件中通过设置EditText的属性来动态切换密码输入的显示方式,实现用户输入密码时的可见性和隐藏效果。
1782

被折叠的 条评论
为什么被折叠?



