android密码显示和隐藏

if (showPwd){
                    //设置EditText文本为可见的
                    password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                    showPassword.setImageResource(R.drawable.ic_show_pwd);
                    showPwd = false;
                }else {
                    //设置EditText文本为隐藏的
                    password.setTransformationMethod(PasswordTransformationMethod.getInstance());
                    showPassword.setImageResource(R.drawable.ic_hide_pwd);
                    showPwd = true;
                }

 

posted @ 2017-02-22 00:11  次序  阅读(267)  评论(0编辑  收藏  举报