Tag Archives: multi line text

Creating multi-line EditText in Android

This is a small guide demonstrating how we can use Android EditText controls to create multi line text inputs.

Approach #1
The simplest way to create a multi line text input is using the following xml snippet:

    <EditText android:id="@+id/txtMultiLine" android:layout_width="200dip" android:layout_height="wrap_content" android:text="Default text" />

This will create a EditText view that displays the default text as shown in Figure 1 (a). When you enter new lines, the EditText will grow vertically (Figure 1 (b)). This might not be desirable in actual applications, as your layout becomes too fluid; potentially pushing important information out of user’s view.
Continue reading