Android 如何滚动到TextView';s文本

Android 如何滚动到TextView';s文本,android,textview,android-scrollview,Android,Textview,Android Scrollview,我有TextView嵌套ScrollView。TextView包含HTML格式的文本。文本的大小可以由用户更改 正文分为以下几个部分: Part1 till <br> Part2 till , Part3 till <br> 有关如何获取任何偏移位置的垂直线,请参见android.text.LayoutAPI。您能准确地说出您真正想要的吗?是否要滚动到特定行或标记或子字符串/文本?单击查看->是否看到android.text.LayoutAPI?什么不清楚?@pskin

我有
TextView
嵌套
ScrollView
TextView
包含HTML格式的文本。文本的大小可以由用户更改

正文分为以下几个部分:

Part1 till <br> Part2 till , Part3 till <br>

有关如何获取任何偏移位置的垂直线,请参见
android.text.Layout
API。您能准确地说出您真正想要的吗?是否要滚动到特定行或标记或子字符串/文本?单击查看->是否看到
android.text.Layout
API?什么不清楚?@pskink我想OP是在寻找代码D
tView = (TextView)findViewById(R.id.your_text_view);
tView.setMovementMethod(new ScrollingMovementMethod());

// tView.append(text + "\n");
tView.scrollTo();
final Layout layout = tView.getLayout(); // <-- THIS RETURN null 
if(layout != null){
int scrollDelta = layout.getLineBottom(tView.getLineCount() - 1) - tView.getScrollY() - tView.getHeight();
     if(scrollDelta > 0)  tView.scrollBy(0, scrollDelta);
}