Limit numbers of lines in TextView

You just have to set a number of lines in your TextView like this:

android:maxLines = "10"

and you must also add:


The rest of this not necessary if you are not using scrolling

and a property which says that this TextView should be scrollable vertically:

android:scrollbars = "vertical"

And in your Java-code:

yourTextView.setMovementMethod(new ScrollingMovementMethod())

Leave a Comment