开发者

Access text of Multiline TextView in Android

I want to access text of particular line in a multi-line TextVi开发者_Go百科ew. Any suggestions on how I could do this?


Fetch the Layout (android.text.Layout) of the TextView by calling mTextView.getLayout(); There you can for instance use the getLineStart or getLineEnd methods to get the offset of the text. That combined with getText and used using normal String operations should probably be enough for u!


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜