0
好了,我有這樣的設置的Android ImageView的手勢/ DoubleTap不點火
滾動型 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);
然而,重寫的自來水方法永遠不會叫......的onTouch確實被調用,而應該是綁我的事件給觸摸事件的detector.onTouchEvent(事件),從來沒有要求我的overRidden方法....所以,我做錯了什麼?
哇,謝謝..我不認爲我會永遠找到一個。如果需要提供其他事件,SimpleGestureListener爲什麼會在該事件中默認返回FALSE。 – user756212