如何防止输入存储在android用户字典中

发布于 2024-11-30 21:38:46 字数 122 浏览 0 评论 0原文

从开发人员的角度来看:有没有办法阻止用户输入添加到我的 Android 应用程序中的用户字典中?

如果我将文本字段设置为 android:password 它不会,但我不想为此使用密码字段。

谢谢!

From a developer perspective: Is there a way to prevent user input to be added to the user's dictionary in my android app?

If I set the text field to android:password it doesn't, but I don't want to use a password field for that.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

涫野音 2024-12-07 21:38:46

在 Nexus 手机上,要将单词添加到用户词典中,您必须使用 Android 键盘,键入单词并选择它,然后再次点击它以保存到词典中。

或者,您可以在“设置”中添加单词,您可以在其中键入要放入词典中的任何单词。

有些手机没有默认的 Android 键盘,所以他们的用户字典功能如何超出了我的范围。 (HTC 似乎会保存您输入过的每一个独特单词)

由于您无法控制用户设备上安装的键盘,因此我认为没有办法控制它。

即使您以某种方式阻止 Android 键盘或任何其他第三方键盘将单词保存到字典中,我认为您也无法阻止用户按“菜单”>“设置>语言和键盘>用户词典,并在那里编辑单词。

最后,我真的很好奇为什么你要限制你的应用程序的此功能。

On Nexus phones, to add a word to user's dictionary, you have to use the android keyboard, type the word, and select it, and tap it again to save to dictionary.

Alternatively, you can add words in Settings, where you can type whatever words you wanna put into the dictionary.

Some phones don't come with a default Android Keyboard, so how their user's dictionary functions is beyond me. (HTC seems to save every single unique word you have ever typed)

Since you have no control of the keyboards installed on your users' devices, I don't think there is a way to control this.

Even if you somehow prevent Android Keyboard or any other third-party keyboards from saving words to the dictionary, I don't think you will be able to stop the user from pressing Menu > Settings > Language and Keyboards > User dictionary , and edit their words there.

Finally, I am really curious why would you want to limit this feature for your App.

jJeQQOZ5 2024-12-07 21:38:46

使用 textNoSuggestions 将禁用单词建议,并且还应该禁用单词自动保存为建议(HTC 手机通常将每个唯一单词保存为建议):

android:inputType="textNoSuggestions"

有关更多信息,请阅读开发人员文档:

textNoSuggestions
可以与文本及其变体结合使用,以指示 IME 不应显示任何基于词典的单词建议。

如果这不起作用,您还可以尝试将其设置为带有可见字符的密码字段:

android:inputType="textVisiblePassword"

Using textNoSuggestions will disable word suggestions, and should also disable the auto-saving of words as suggestions (HTC phones usually save every unique word as a suggestion):

android:inputType="textNoSuggestions"

For more information, read the developer docs:

textNoSuggestions
Can be combined with text and its variations to indicate that the IME should not show any dictionary-based word suggestions.

If that's not working you could also try to set it as a password field with visible characters:

android:inputType="textVisiblePassword"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文