Android Ice Cream Sandwich Edittext: Disabling Spell Check and Word Wrap

前端 未结 7 1842
-上瘾入骨i
-上瘾入骨i 2020-12-23 13:42

Whilst testing on the Android Emulator running Android 4.0 (Ice Cream Sandwich), I have noticed that the Edittext does some quite strange things.

Firstly, it underlin

7条回答
  •  旧巷少年郎
    2020-12-23 14:22

    Disabling Spell-Checking
    In order to get rid of spell checking you must specify the EditText's InputType in the XML as the following:

    android:inputType="textNoSuggestions"

    However, my EditText needed also to be multiline, so I have added the following line to the EditText's XML:

    android:inputType="textMultiLine|textNoSuggestions"

    Disabling Word-Wrap
    As noted, the XML attribute android:scrollHorizontally="true" does not work. However, strangely, if it is done through Java it does work. Here is the necessary code to achieve no word wrapping:

    mEditText.setHorizontallyScrolling(true);

提交回复
热议问题