我创建了一个带编辑文本的警告对话框。如何将edittext的属性设置为密码?
这是代码......
final AlertDialog.Builder alert = new AlertDialog.Builder(this);
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_TEXT| InputType.TYPE_TEXT_VARIATION_PASSWORD);
alert.setView(input); //edit text added to alert
alert.setTitle("Password Required"); //title setted
答案 0 :(得分:8)
input.setTransformationMethod(PasswordTransformationMethod.getInstance());