Access Text Multiline TextView on Android

I want to access the text of a specific line in a multi-line TextView. Any suggestions on how I can do this?

+4
source share
2 answers

Extract the layout ( android.text.Layout ) from the TextView by calling mTextView.getLayout (); There you can, for example, use the getLineStart or getLineEnd methods to get the text offset. What combined with getText and used using regular String operations should be enough for u!

+4
source

By default, the text view is multi-line. Set text with new lowercase characters for ex. "First line \ nNorth line".

Another parameter is also specified here: https://stackoverflow.com/questions/2610280/how-to-get-multi-line-text-on-a-button-in-android

0
source

Source: https://habr.com/ru/post/1346020/


All Articles