Show the password with EditText

前端 未结 12 916
旧时难觅i
旧时难觅i 2021-01-30 22:04

I use an EditText to enter password. And a CheckBox to show password or not. Below function is the part:

public void ShowPassword() {
    if (cb.isChecked()) {
          


        
12条回答
  •  面向向阳花
    2021-01-30 22:45

    public void onCheckBox(View v2)
    {
    
    
    
        CheckBox cb = (CheckBox)this.findViewById(R.id.pass_Check);
        EditText et1=(EditText)this.findViewById(R.id.edt_Pass);
            if(cb.isChecked())
            {
            et1.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
            }
            else 
            {
            et1.setInputType(129);
            }
    
    }
    

提交回复
热议问题