line breaking of an edittext automatically on android

Asked

Viewed 1,558 times

0

Hello! in my application the client can make a comment with up to 300 characters, only it is bad to make long texts with edittext only in one line then how to break the line automatically? an example is when we make comments on facebook, the text is breaking the line and descending instead of disappearing as usual in edittext,

an example in my edittext: Lorem Ipsum is simply a simulation of the typesetting industry

I’d like to keep it this way: Lorem Ipsum is simply a simulation of the printing industry
Lorem Ipsum is simply a simulation of the printing industry
Lorem Ipsum is simply a simulation of the printing industry

  • I don’t have a code ready to show you, but the edittext’s minimum and maximum height search and don’t forget to make the "singleLine" attribute false. I didn’t help much, but I think it’s a way

  • thanks for the help William.

1 answer

0


You can use the attributes maxLines and/or inputType, that way:

  <EditText
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:maxLines="5"
       android:inputType="textMultiLine"
       android:textSize="16sp" />

In your case, I believe only using the inputType="textMultiLine" will already solve, and the text will break as insertion.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.