在Android的多行的TextView的文本访问 [英] Access text of Multiline TextView in Android

查看:120
本文介绍了在Android的多行的TextView的文本访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要访问在多行的TextView特定行的文本。我如何能做到这一点有什么建议?

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

推荐答案

抓取布局(的 android.text.Layout )TextView的通过调用mTextView.getLayout();在那里,你可以,例如使用getLineStart或getLineEnd方法来获取文本的偏移量。随着合并的getText使用正常的字符串操作也许应该是足够用ü!

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!

这篇关于在Android的多行的TextView的文本访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆