在三星键盘上禁用文本预测

Disable text prediction on samsung Keybord

我的 android 应用程序中有一个文本编辑字段,此文本字段用于序列号,因此不应自动完成文本。

我设法在标准 android 键盘上解决了这个问题,但无论我设置什么标志,三星键盘仍然显示建议和自动完成,这些是我当前的标志:

 android:inputType="textFilter|textNoSuggestions|textCapCharacters|textVisiblePassword"

我也试过

android:privateImeOptions="nm"

那么,关于如何以编程方式禁用它还有其他想法吗?

managed to solve it on the stock android keyboard but the samsung keyboard is still showing suggestions

textNoSuggestions 标志仅用于此目的,不需要额外的技巧。如果是的话,那么这里有什么东西坏了。尽管如此,我肯定会尽量避免为某个特定的 IME 做任何特殊的事情。

docs阅读:

textNoSuggestions

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

单词 "should" 是这里的关键,因此基本上取决于 IME 是否满足您的请求,您可能什么也做不了。

顺便说一句:如果它也忽略 textVisiblePassword 并显示密码字典,那么它不是一个好的键盘。如果它也向字典添加密码,我不会感到惊讶:)

在我看来,如果我放下 textFilter 标志只是为了离开

,某些标志在三星键盘上不能很好地协同工作
android:inputType="textNoSuggestions|textCapCharacters|textVisiblePassword"

它按预期工作,但如果将 textFilter 添加到 inputType,它将忽略其余的