2017-01-27 46 views
1

我试着改变显示密码设置为true编程方式 Android的设置 - >安全 - > Passwords->使密码可见:安卓使密码可见

Android.Provider.Settings.Secure.PutInt(Application.Context.ContentResolver, Settings.Secure.NameOfMissingConstant, 1); 

和无法接缝找到所需的常量此在Settings.Secure选项

回答

0
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); 
    } 

} 

public void onCheckBox(View v2) 
{ 
    CheckBox cb = (CheckBox)this.findViewById(R.id.checkBox); 
    cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 
     @Override 
     public void onCheckedChanged(CompoundButton compoundButton, boolean  b) { 
      if(!b) 
      { 
        password.setTransformationMethod(PasswordTransformationMethod.getInstance()); 
      } 
      else 
      { 
       password.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); 
      } 
     } 
    }); 

} 
1

如果s omeone仍在寻找答案android.provider.Settings.System.putInt(this.getContentResolver(),android.provider.Settings.System.TEXT_SHOW_PASSWORD, 0);