0

在我们的应用程序中,我们使用 Android Wheel 库。问题出在 Galaxy SII 上。滚轮只有在用户触摸它时才起作用,将手指移到侧面(离开滚轮)然后向上或向下滚动。有没有人也有这个问题和可能的解决方案?

4

1 回答 1

0

这是 kankan android-wheel 库的错误。在第 611 行的 WheelView.java 中,将 switch 语句更改为以下内容:

switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN: //added to fix problem
    case MotionEvent.ACTION_MOVE:
        if (getParent() != null) {
            getParent().requestDisallowInterceptTouchEvent(true);
    }
    break;

    case MotionEvent.ACTION_UP:
        if (getParent() != null) { //added to fix problem, this may be uneeded
            getParent().requestDisallowInterceptTouchEvent(false);
        }

    if (!isScrollingPerformed) {
        int distance = (int) event.getY() - getHeight() / 2;
        if (distance > 0) {
            distance += getItemHeight() / 2;
        } else {
                distance -= getItemHeight() / 2;
        }
        int items = distance / getItemHeight();
        if (items != 0 && isValidItemIndex(currentItem + items)) {
                notifyClickListenersAboutClick(currentItem + items);
            }
    }
    break;
}
于 2013-02-12T08:41:36.320 回答