如何以编程方式在Android中禁用拼写更正

问题描述:

如何以编程方式停用拼写校正的Andr​​oid?用户可以通过设置来禁用它,但我需要在我的应用程序禁用它。

How can I disable the spell correction programmatically in android? User can disable it from settings, but I need disable it in my application.

有没有办法做到这一点?

Is there any way to do this?

设置这个在布局的XML为您的EditText:

Set this in your layout's xml for your EditText:

安卓inputType =textNoSuggestions

或呼叫 setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)在你的活动

如果您需要支持的API 4及以下,使用安卓inputType =为TextFilter

If you need to support API 4 and below, use android:inputType="textFilter"