密码隐藏或显示
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());
}
});
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());
}
});
相关文章推荐
- 给密码框添加一个显示隐藏开关
- 关于Android EditText密码显示隐藏切换
- EditText 密码显示 隐藏三种方法
- android程序代码实现改变字体颜色和输入密码的显示隐藏
- python getpass模块:隐藏不显示输入的密码
- Editext的密码显示与隐藏
- 利用UGUI InputField 实现 显示/隐藏密码 功能
- JS实现登录页密码的显示和隐藏功能
- EditText的换行输入、输入起始位置、调用指定格式的系统键盘(显示和隐藏),光标颜色,密码动态设置可见性
- js实现的键盘开启大写锁定提示和密码显示与隐藏的效果
- 输入密码或金额的显示和隐藏
- Android密码框中显示隐藏密码
- 通过jquery做密码框的显示和隐藏效果
- Android中设置EditText显示或隐藏密码
- Android之EditText 为密码输入框时,密码的显示与隐藏
- android EditText中的密码显示与隐藏
- android:设置密码隐藏与显示
- 点击按钮,editText 显示/隐藏密码
- Android实现密码隐藏显示
- 密码隐藏与显示