好的,我有这个设置
滚动型 HorizontalScrollView ImageView的
我正在尝试捕获图像视图上的doubleTap ..我的代码如下所示:
ImageView iv = (ImageView)findViewById(R.id.ImageViewID);
iv.setImageDrawable(iv.getResources().getDrawable(R.drawable.someimage));
// Gesture detection
detector = new GestureDetector(this,new SimpleOnGestureListener(){
//new myGestureClass());
@Override
public boolean onSingleTapUp(MotionEvent e) {
// TODO Auto-generated method stub
System.out.println("SINGLE TAP");
return false;
}
@Override
public boolean onDoubleTap(MotionEvent arg0) {
// TODO Auto-generated method stub
System.out.println("DOUBLE TAP");
return false;
}
@Override
public boolean onDoubleTapEvent(MotionEvent arg0) {
// TODO Auto-generated method stub
System.out.println("DOUBLE TAP EVENT");
return false;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent arg0) {
// TODO Auto-generated method stub
return false;
}
});
View.OnTouchListener gestureListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
System.out.println("TOUCH!" +event);
if (detector.onTouchEvent(event)) {
return true;
}
return false;
}
};
iv.setOnTouchListener(gestureListener);
然而被覆盖的tap方法永远不会被调用... onTouch会被调用,但是应该将我的事件绑定到touch事件的detector.onTouchEvent(event),永远不会调用我的overRidden方法....所以,我到底做错了什么?