How to allow multi-line in Android\'s EditText
view?
<EditText
android:id="@id/editText" //id of editText
android:gravity="start" // Where to start Typing
android:inputType="textMultiLine" // multiline
android:imeOptions="actionDone" // Keyboard done button
android:minLines="5" // Min Line of editText
android:hint="@string/Enter Data" // Hint in editText
android:layout_width="match_parent" //width editText
android:layout_height="wrap_content" //height editText
/>
You may find it better to use:
<EditText
...
android:inputType="textMultiLine"
/>
This is because android:singleLine
is deprecated.
I learned this from http://www.pcsalt.com/android/edittext-with-single-line-line-wrapping-and-done-action-in-android/, though I don't like the website myself. If you want multiline BUT want to retain the enter button as a post button, set the listview's "horizontally scrolling" to false.
android:scrollHorizontally="false"
If it doesn't work in xml, doing it programmatically weirdly works.
listView.setHorizontallyScrolling(false);