Kaylee
Kaylee

Reputation: 145

Adding an inputType prevents editText from re sizing

basically adding an inputType to a textView will stop it from changing the number of lines. ie: without inputType when you reach the end of an editText it will grow in size and you will continue typing on the second line, in the case of adding the inputType you simply scroll sideways

<EditText
    android:id="@+id/editText_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:maxLines="5"
    android:ems="10"
    android:imeOptions="actionNext"
    android:inputType="textPersonName" >

    <requestFocus />
</EditText>

so how can I get both inputType and automatic re sizing?

Upvotes: 0

Views: 52

Answers (1)

Boris Pawlowski
Boris Pawlowski

Reputation: 1771

This will solve your problem:

<EditText
    android:id="@+id/editText_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:ems="10"
    android:imeOptions="actionNext"
    android:inputType="textMultiLine"
    android:maxLines="5" >

    <requestFocus />
</EditText>

Upvotes: 1

Related Questions