Android TextView和ScrollingMovementMethod故障

Android TextView和ScrollingMovementMethod故障,android,textview,android-scroll,Android,Textview,Android Scroll,我现在这样做是为了使我的文本视图可滚动: myTextView.setMovementMethod(new ScrollingMovementMethod()); 我想要的是,在创建时,让TextView的可见部分成为我选择的某一行文本 就像现在一样,它只是在文本视图中显示我文本的顶部,允许我向下滚动 我无法设置滚动条的起始位置吗?我一直在寻找,但没有结果。谢谢。这会很有帮助,试试吧 final int amount = yourTextView.getLayout().getLine

我现在这样做是为了使我的文本视图可滚动:

myTextView.setMovementMethod(new ScrollingMovementMethod());
我想要的是,在创建时,让TextView的可见部分成为我选择的某一行文本

就像现在一样,它只是在文本视图中显示我文本的顶部,允许我向下滚动


我无法设置滚动条的起始位置吗?我一直在寻找,但没有结果。谢谢。

这会很有帮助,试试吧

    final int amount = yourTextView.getLayout().getLineTop(yourTextView.getLineCount()) - yourValue;
    // if there is no need to scroll, amount will be <=0
    if (amount > 0)
        yourTextView.scrollTo(0, amount);
    else
        yourTextView.scrollTo(0, 0);
final int amount=yourTextView.getLayout().getLineTop(yourTextView.getLineCount())-yourValue;
//如果不需要滚动,金额将为0)
yourTextView.scrollTo(0,金额);
其他的
yourTextView.scrollTo(0,0);