简体   繁体   中英

Android 4.0+ EditText disable autocorrection

Im looking for a way to disable autocorrection in EditText (and optionally to live autosuggestions). Current code:

<EditText
    android:id="@+id/text_message_edit_text"
    android:layout_width="240dp"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="textCapSentences|textMultiLine|textNoSuggestions|textFilter"
    android:textSize="20sp" />

I have tried this solution adding textVisiblePassword attribute. It helped me, but after this button for language switch become disabled.

Is there a 100% way? No. Every keyboard application interprets the inputTypes a little differently, and not all of them honor all input types. So there is no universal way to insure no auto corrects. Visible password is the best way since almost all keyboards honor it for security reasons. Filter and no suggestions are also common flags to do it, but you have those. You're doing everything you can I'm afraid- that keyboard just is ignoring you and showing it no matter what.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM