user2442638
user2442638

Reputation:

Android: EditText - multiple lines and android:inputType

I am having a (?simple?) problem with EditText. Whenever I type in it, the text stays in the same line even when I get to the edge of the screen instead of creating a new line. I sure I remember it doing this by default before, but I can't seem to get it to work know...

<EditText
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="@string/hint"
        android:inputType="textCapSentences" />

EDIT: The problem is because a have android:inputType. Is there any way to have the input type with the multiple lines?

Upvotes: 10

Views: 5618

Answers (1)

Plastic Sturgeon
Plastic Sturgeon

Reputation: 12527

You can set more than one property on the input type by separating the flags with the pipe "|" character. Try a setting like:

android:inputType="textCapSentences|textMultiLine"

Complete Code:

<EditText
    android:id="@+id/title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/hint"
    android:lines="3"
    android:inputType="textCapSentences|textMultiLine" />

Upvotes: 34

Related Questions