Like described in API for minLines
and maxLines
attribute, you have to use the attribute android:inputType="textMultiLine"
too:
API:
android:maxLines
Makes the TextView be at most this many lines tall.
When used on an editable text, the inputType attribute's value must be
combined with the textMultiLine flag for the maxLines attribute to
apply.
android:minLines
Makes the TextView be at least this many lines tall. When used on an
editable text, the inputType attribute's value must be combined with
the textMultiLine flag for the minLines attribute to apply.
<EditText
android:id="@+id/et_firstname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/view_margin_below"
android:hint="@string/et_firstname"
android:maxLength="20"
android:minLines="1"
android:inputType="textMultiLine"
android:maxLines="1" />
So I guess, You just have to add this attribute.
EDIT
To avoid misunderstandings: The behaviour of these attributes will allow to enter multiple lines, but it will be only shown one line. BUT, it´s scrollable, so if you put in some more lines, you can scroll up and down to see the other lines.
This is stated in API for singleLine
. minLines
and maxLines
work similar:
Constrains the text to a single horizontally scrolling line instead of
letting it wrap onto multiple lines