2012-01-05 181 views
0

我有滚动型宽度和高度FILL_PARENT和我实现SimpleOnGestureListener像滚动型不垂直滚动

scroller.setOnTouchListener(new OnTouchListener() { 
       @Override 
       public boolean onTouch(View v, MotionEvent event) { 
        gdt.onTouchEvent(event); 
        return true; 
       } 
      }); 

private class GestureListener extends SimpleOnGestureListener { 
    @Override 
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, 
      float velocityY) { 
     if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE 
       && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { 
      btnNextQuestion.performClick(); 
      return true; // Right to left 
     } 
     return false; 
    } 
} 

而且目前只从右侧的触摸反应,离开的时候是一步比不变,而不是做大在垂直移动中作出反应。什么改变到ScrollView反应(垂直移动默认行为,滚动内容)?有人能帮我吗 ?

回答

1

您总是onTouch()方法返回trueOnTouchListener()内,这意味着你已经消耗的事件(做实际的滚动......),因此Android不会滚动你的看法。

要让Android处理滚动,只需从onTouch()方法返回false即可。