好吧,我希望你现在得到你的答案,但我还是会发一个,以备将来使用…
您需要覆盖
OnScrollListener
计算一下你自己的速度。
根据运动学:
Distance/Time = Speed
private class SpeedDetectorOnScrollListener implements OnScrollListener {
private long timeStamp;
private int prevFirstVisibleItem;
private int scrollingSpeed;
public SpeedDetectorOnScrollListener () {
timeStamp = System.currentTimeMillis();
lastFirstVisibleItem = 0;
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
long lastTime = System.currentTimeMillis();
timeStamp = lastTime;
lastFirstVisibleItem = firstVisibleItem;
scrollingSpeed = (firstVisibleItem - lastFirstVisibleItem)/(lastTime-timeStamp)
}
public int getSpeed()
{
return scrollingSpeed;
}
}