简体   繁体   English

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

[英]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.

相关问题 如何在android中以编程方式启用或禁用隐身键盘? - How to enable or disable incognito keyboard programmatically in android? 如何在Android中以编程方式禁用移动数据连接? - How to disable mobile data connection in android programmatically? 以编程方式在Android上禁用GPS - Disable GPS on Android Programmatically 如何在android中以编程方式启用/禁用gps和移动数据? - How to enable/disable gps and mobile data in android programmatically? Android:如何以编程方式启用/禁用 Wifi 或 Internet 连接 - Android: How to Enable/Disable Wifi or Internet Connection Programmatically 如何以编程方式禁用 android 中其他应用程序的网络使用? - how to disable network usage for other application in android programmatically? 如何在 Android 上以编程方式启用/禁用热点或网络共享模式? - How do I enable/disable hotspot or tethering mode programmatically on Android? 如何以编程方式禁用“省电”模式。 (Android) - How to disable “Power saving” mode programmatically. (Android) 如何在Android 4.0+设备上以编程方式禁用“窗口动画比例”? - How to disable “Window animation scale” programmatically on Android 4.0+ devices? 如何在 android studio 上以编程方式检查自动启动权限是启用还是禁用 - how to check Programmatically AutoStart Permission is Enable or disable on android studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM