Android的GridView滚动速度计算

怎么计算出Android的GridView的滚动速度,用于GridView加载网络图片,当滚动过快就不加载图片,滚动慢就加载图片

跟运行速度会有关系吗

在ontouchEvent中这样处理
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
mVelocityTracker.addMovement(event);
用下面这个获取速度
mVelocityTracker.computeCurrentVelocity(1000, MAX_YVELOCITY);
int velocity = (int)mVelocityTracker.getYVelocity();

不过你可能不需要这样,你可以延时加载网络图片,滑过去了就cancel掉