ScrollTextView - scrolling TextView for Android
2010-04-13 21:01:00 来源:WEB开发网return;
if (mPaused)
return;
mPaused = true;
// abortAnimation sets the current X to be the final X,
// and sets isFinished to be true
// so current position shall be saved
mXPaused = mSlr.getCurrX();
mSlr.abortAnimation();
}
@Override
/*
* override the computeScroll to restart scrolling when finished so as that
* the text is scrolled forever
*/
public void computeScroll() {
super.computeScroll();
if (null == mSlr) return;
if (mSlr.isFinished() && (!mPaused)) {
this.startScroll();
}
}
public int getRndDuration() {
return mRndDuration;
}
public void setRndDuration(int duration) {
this.mRndDuration = duration;
}
public boolean isPaused() {
return mPaused;
}
}
/*************************************************************************/
Issues to be fixed:
Do not know why it would not scroll sometimes if setHorizontallyScrolling is called in constructor;
The scrolling is not smooth enough. Maybe it's because of the single thread model of Android UI;
Tested on:
Windows XP
Android SDK 1.0 rc2
Android Emulator 1.0
Android Debug Bridge version 1.0.20
Tags:ScrollTextView scrolling TextView
编辑录入:coldstar [复制链接] [打 印]赞助商链接