java 如何在 Android 中以编程方式禁用拼写更正
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7330234/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to disable spelling corrections programmatically in Android
提问by Adem
How can I disable spelling corrections in an EditText
's soft-keyboard programmatically in Android? The user can disable it from settings, but I need to disable it in my application.
如何EditText
在 Android 中以编程方式禁用软键盘中的拼写更正?用户可以从设置中禁用它,但我需要在我的应用程序中禁用它。
Is there any way to do this?
有没有办法做到这一点?
回答by CrackerHyman9
Set this in your layout's xml for your EditText:
在您的 EditText 布局的 xml 中设置此项:
android:inputType="textNoSuggestions"
android:inputType="textNoSuggestions"
Or call setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)
in your Activity'
或调用setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)
您的活动'
If you need to support API 4 and below, use android:inputType="textFilter"
如果您需要支持 API 4 及以下,请使用 android:inputType="textFilter"
回答by pjheink
If setting:
如果设置:
android:inputType="textNoSuggestions"
still doesn't work (and your text field is small), a quick work-around is to use:
仍然不起作用(并且您的文本字段很小),一个快速的解决方法是使用:
android:inputType="textVisiblePassword"