2017-01-27 70 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);