Possible Duplicate:
Android Listview slow down scroll speed
When a user swipes on a ListView
its' scrolling speed can get pretty high. I'd like to limit the speed - is it possible ?
Possible Duplicate:
Android Listview slow down scroll speed
When a user swipes on a ListView
its' scrolling speed can get pretty high. I'd like to limit the speed - is it possible ?
Check this out -:
private class SpeedMeterOnScrollListener implements OnScrollListener {
private long timeStamp;
private int lastFirstVisibleItem;
public SpeedMeterOnScrollListener() {
timeStamp = System.currentTimeMillis();
lastFirstVisibleItem = 0;
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
long lastTime = System.currentTimeMillis();
//calculate speed by firstVisibleItem, lastFirstVisibleItem, timeStamp and lastTime
timeStamp = lastTime;
lastFirstVisibleItem = firstVisibleItem;
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
}