I have this stupid and seemingly trivial problem with the properties of an EditText.
The properties I am trying to achieve for the EditText, are the following:
The contents of the view should NOT contain newlines. It can be text, numbers, symbols, but no newlines.
The soft keyboard should NOT display the enter button because of the above. It should instead display something like "Send" or "Done".
The contents of the view should NOT continue horizontally when reaching the edge of the screen. Instead I want to wrap the text, displaying it on multiple lines.
I have tried many different combinations, but I can not achieve this combination.
What I currently have is this, which is inside a RelativeLayout:
<EditText
android:id="@+id/comment_box"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_below="@id/preparation_text"
android:hint="@string/comment_hint"
android:inputType="textCapSentences|textAutoCorrect|text"
android:scrollHorizontally="false"
android:maxLength="400"
android:imeOptions="actionSend"/>
It achieves 2 of 3. No newlines possible, keyboard displays "Send" rather than the enter-key for me, but the text continues on one line.
Changing inputType="text"
to "textMultiLine"
wraps text correctly on multiple lines, but also overrides the keyboard to always display the enter button.
I have tried different solutions around the Internet, including setting the properties maxLines="4"
, singleLine="true"
and possible others that I have forgotten again.
I can not find a combination that works.