您的位置:首页 > 其它

密码隐藏或显示

2012-11-06 15:24 232 查看
// 设置密码隐藏或显示,并且将光标定位到文本最后

showPwd.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

@Override

public void onCheckedChanged(CompoundButton buttonView,

boolean isChecked) {

if (isChecked) {

pwdText.setTransformationMethod(HideReturnsTransformationMethod

.getInstance());

} else {

pwdText.setTransformationMethod(PasswordTransformationMethod

.getInstance());

}

CharSequence pwdStr = pwdText.getText().toString()

.trim();

pwdText.setSelection(pwdStr.length());

}

});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: