[英]How to disable spelling corrections programmatically in Android
How can I disable spelling corrections in an EditText
's soft-keyboard programmatically in Android? 如何在Android中以编程方式禁用EditText
的软键盘中的拼写更正? The user can disable it from settings, but I need to disable it in my application. 用户可以从设置中禁用它,但我需要在我的应用程序中禁用它。
Is there any way to do this? 有没有办法做到这一点?
Set this in your layout's xml for your EditText: 在您的EditText的布局xml中设置它:
android:inputType="textNoSuggestions"
Or call setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)
in your Activity' 或者在您的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"
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"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.