Android: Multiline & No autosuggest in EditText

戏子无情 提交于 2019-12-01 03:46:17

This is supposed to do what you want:

android:inputType="textFilter|textMultiLine|textNoSuggestions"

Although I haven't tried it myself. "textNoSuggestions" is only available since API 5.

If you created Edittext Dynamically and want to achieve Multiline & No autosuggest then you need to use: setRawInputType

editText.setRawInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

you can also use android:SingleLine="false" to use multiline for an EditText

Jul

Warning: it looks like this is API version dependent.

textFilter option alone works for me on a tab running 3.1 (no suggestion when typing) but it does not work on a smartphone running 2.2 (still suggest when typing).

On 2.2 I use :

android:inputType="textVisiblePassword"

Annoying none the less if we have to check against all different API...

Chitransh Mathur
android:inputType="textVisiblePassword"

It is working on android 2.3.x and above.

Works for me

android:inputType="textVisiblePassword|textMultiLine"

A bit later than the others & the answer has been accepted, but after some testing on various devices, some keyboards ignore textFilter and textNoSuggestion, the only way that I've found to guarantee no keyboard is using textVisiblePassword

If you want it on a multi-line, you can use:

android:inputType="textVisiblePassword|textMultiLine"

Note that it has little to do with the API level, but more to do with the keyboard installed - the default Samsung keyboard on slightly older devices, SwiftKey & TouchPal definitely ignore textFilter & textNoSuggestion

I hope this helps someone else in the future

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!