Singee
Singee

Reputation: 523

How to set MaxLines in TextView but allowing update text - Android

I've setted maxLines in my TextView, to avoid that too much lines are printed, with this attribute:

android:maxLines="500"

But this is not what I'm looking for since when I reach 500 lines I can't add new text. I'm looking for something circular, I should continue to be able to add new text lines but for every new text lines an older one is deleted.

Is possible in an easy way to do this?

Upvotes: 0

Views: 376

Answers (1)

Muhammad Catubig
Muhammad Catubig

Reputation: 311

You might want to check the difference between maxLines and lines.

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.

and

lines - Makes the TextView be exactly this many lines tall.

There is also called maxLength where it sets an input filter to constrain the text length to the specified number

Upvotes: 1

Related Questions