我已經使用了滾動條進行自動滾動,但即使文本結束,滾動條仍然保持滾動狀態。我想找到位置,並且想要自動停止滾動,所以當文本滾動文本時,文本會到達其初始位置。我怎樣才能做到這一點?如何在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