eye.setOnCheckedChangeListener { _, isChecked -> pwdInput.transformationMethod = if (isChecked) PasswordTransformationMethod.getInstance() else HideReturnsTransformationMethod.getInstance() }
eye是checkBox控件,pwdInput是输入框edittext控件,如果是选择状态,则密码可见,否则隐藏。