MultiLine EditText in Android Material design

Amardeepvijay picture Amardeepvijay · Aug 6, 2015 · Viewed 13.2k times · Source
<android.support.design.widget.TextInputLayout
            android:id="@+id/float_edit_description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/ll4"
            android:layout_marginTop="5dp">

            <EditText
                android:id="@+id/edit_description"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:focusable="true"
                android:gravity="top|left"
                android:hint="Description"
                android:inputType="text"
                android:maxLines="3"
                android:paddingTop="0dp"
                android:scrollbars="vertical"
                android:textColor="@android:color/black"
                android:textColorHint="@color/hint_grey" />
        </android.support.design.widget.TextInputLayout>

I want to make the above EditText to have multi line. If the user press "enter" the cursor should get down to the second line.

Answer

sasikumar picture sasikumar · Aug 6, 2015

Add your EditText

<EditText 
...
android:inputType="textMultiLine"
/>