Set EditText to be Multiline(Enter is carrige retu

2019-09-19 12:22发布

问题:

I am trying to set a Android EditText to be Multiline, and not display any suggestions.

    textView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);

However, this is just a single line. Currently pressing the enter/carriage return button hides the keyboard, instead of moving to a new line.

        textView.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);

Setting the IME flag causes the enter button to insert whitespace. I need to display no suggestions and also have the EditText to be multiline. Am I missing something here?

回答1:

I have solved this issue. I was using SwiftKey keyboard, swapping to the default Google keyboard seems to work perfectly. My guess is swiftkey doesn't have some of these methods implemented?