我已经使用了滚动条进行自动滚动,但即使文本结束,滚动条仍然保持滚动状态。我想找到位置,并且想要自动停止滚动,所以当文本滚动文本时,文本会到达其初始位置。我怎样才能做到这一点?如何在textview中实现Scroller进行自动滚动?
用于自动滚动的代码是:
public void Scroll()
{
//text = (TextView) findViewById(R.id.TxtView);
length = text.getLineCount();
scroll.computeScrollOffset();
text.setScroller(scroll);
int a = text.getBottom();
int b = text.getTop();
//scroll.extendDuration(scroll.getFinalY());
scroll.startScroll(scroll_x, scroll_y, 0, a, (500000)/ speedAmount);
}
对不起,我已经使用了这些方法,但这不是这样......我在找什么 – Nikki 2010-11-29 09:22:02
@Nikki你的意思是只滚动一次吗?您可以使用scroll.isFinished()检查滚动文本是否完成,然后是scroll.abortAnimation()。我希望我在帮助你方面是正确的。 – 100rabh 2010-11-29 09:56:18