No suggestion Edit multi-line text in android

I want to implement Multiline EditText without a suggestion in android. I have a lot of googled and I found below code:

noticeEditText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); 

or

 noticeEditText.setInputType( android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD ); 

or

In the layout file:

  android:inputType="textFilter" 

But my problem lies in the fact that without a sentence, Edit Text has a single line . I also add properties below:

 noticeEditText.setSingleLine(false); noticeEditText.setVerticalScrollBarEnabled(true); noticeEditText.setHorizontalScrollBarEnabled(false); 

But still getting a separate line Editing a text view. What should I do to get a multi-line text view without a suggestion .

Thanks.

+6
source share
3 answers

Try this and you will be happy:

 android:inputType="textFilter|textMultiLine|textNoSuggestions" 

It should work well for you.

+5
source

In your .xml layout file for your EditText you can set various attributes to suit your needs. For your current requirement, add this to Edit Text.

 <EditText .... android:inputType="textFilter|textMultiLine|textNoSuggestions" /> 
0
source

I found the same problem in my code and solved it, I used the @Marek solution in my XML file - android:inputType="textFilter|textMultiLine|textNoSuggestions"

and removed from java file -
.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

0
source

Source: https://habr.com/ru/post/951995/


All Articles