I have a TextView that I\'m dynamically adding text to.
in my main.xml file I have the properties set to make my max lines 19 and scrollbar
(2017) using Kotlin:
// you need this to enable scrolling:
mTextView.movementMethod = ScrollingMovementMethod()
// to enable horizontal scrolling, that means word wrapping off:
mTextView.setHorizontallyScrolling(true)
...
mTextView.text = "Some long long very long text content"
mTextView.post {
val scrollAmount = mTextView.layout.getLineTop(mTextView.lineCount) - mTextView.height
mTextView.scrollTo(0, scrollAmount)
}
This works file for me