2

可能重复:
Android Listview 减慢滚动速度

当用户在其上滑动时,ListView其滚动速度会变得相当高。我想限制速度 - 可以吗?

4

1 回答 1

0

看一下这个 -:

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) {
        }
    }
于 2012-07-12T09:20:53.960 回答