Allow multi-line in EditText view in Android?

Adham picture Adham · Nov 20, 2010 · Viewed 378.4k times · Source

How to allow multi-line in Android's EditText view?

Answer

Shardul picture Shardul · Nov 20, 2010

By default all the EditText widgets in Android are multi-lined.

Here is some sample code:

<EditText
    android:inputType="textMultiLine" <!-- Multiline input -->
    android:lines="8" <!-- Total Lines prior display -->
    android:minLines="6" <!-- Minimum lines -->
    android:gravity="top|left" <!-- Cursor Position -->
    android:maxLines="10" <!-- Maximum Lines -->
    android:layout_height="wrap_content" <!-- Height determined by content -->
    android:layout_width="match_parent" <!-- Fill entire width -->
    android:scrollbars="vertical" <!-- Vertical Scroll Bar -->
/>