回答

0

的問題是在onFling()方法。如果操作成功完成,則此方法應返回true,否則調用onClickItemClicked()

@Override 
public boolean onFling(MotionEvent e1, MotionEvent e2, 
     float velocityX, float velocityY) { 
    if (e2.getAction()!=MotionEvent.ACTION_UP){ 

     return false; 
    } 

    try { 
     float diffAbs = Math.abs(e1.getY() - e2.getY()); 
     float diff = e1.getX() - e2.getX(); 

     if (diffAbs > SWIPE_MAX_OFF_PATH) 
      return false; 

     // Left swipe 
     if (diff > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { 
      listener.onLeftSwipe(); 

      // Right swipe 
     } else if (-diff > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { 
      listener.onRightSwipe(); 
     } 
     return true; 
    } catch (Exception e) { 
    } 
    return false; 
} 
0

您可以嘗試

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { 
    view.requestDisallowInterceptTouchEvent(true); 
    ..... 
    view.requestDisallowInterceptTouchEvent(false); 
} 

也許有助於