ListView: limit scrolling speed [duplicate]

+2 votes
asked Jul 12, 2012 by user1462299

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 ?

1 Answer

0 votes
answered Nov 29, 2018 by vipul-j

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) { } }
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter