我想要在首选项中设置一个允许用户创建密码的设置。 Play 商店就是一个完美的例子。在设置中,单击“密码”,会弹出一个对话框,其中包含一个 EditText
字段,其中包含隐藏字符的密码字段。你会怎么做?
我很确定这不是 EditTextPreference
。这是自定义偏好吗?你会怎么做这个?我可以获得 XML 部分的示例吗?
最佳答案
I'm pretty sure this is not EditText preference
EditTextPreference
可以工作。引用the documentation :
This EditText can be modified either programmatically via getEditText(), or through XML by setting any EditText attributes on the EditTextPreference.
因此,添加 android:password="true"
作为您的首选项 XML 的一部分应该可行。
话虽如此,我们当然欢迎您为此创建自己的自定义 DialogPreference
。
关于android - 在设置中创建 Android 首选项以设置密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20734639/