【问题标题】:Android wheel on Samsung Galaxy S2 ICS三星 Galaxy S2 ICS 上的 Android 滚轮
【发布时间】:2013-02-12 08:28:06
【问题描述】:

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

【问题讨论】:

    标签: android galaxy android-wheel


    【解决方案1】:

    这是 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;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-27
      • 1970-01-01
      • 1970-01-01
      • 2014-09-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多