我试图以编程方式将make密码可见设置为true android设置 - >安全 - >密码 - >使密码可见:
Android.Provider.Settings.Secure.PutInt(Application.Context.ContentResolver, Settings.Secure.NameOfMissingConstant, 1);
并且无法在Settings.Secure
中找到此选项所需的常量答案 0 :(得分:1)
如果有人仍在寻找答案android.provider.Settings.System.putInt(this.getContentResolver(),android.provider.Settings.System.TEXT_SHOW_PASSWORD, 0);
答案 1 :(得分: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());
}
}
});
}