Hello all,
Is there a way to detect the onFling gesture in a WebView? It doesn't
seem to get recognised, for example:
I'll add all the code because it's a pretty good example of how to
listen to gesture...
gestureDetector = new GestureDetector(new mGestureDetector());
gestureListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (gestureDetector.onTouchEvent(event)) {
return true;
}
return false;
}
};
...
class mGestureDetector extends SimpleOnGestureListener {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float
velocityX, float velocityY) {
try {
if (Math.abs(e1.getY() - e2.getY()) >
SWIPE_MAX_OFF_PATH)
return false;
// Right to left fling
if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
Log.d(TAG, "Right to left fling");
} else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
Log.d(TAG, "Left to right fling");
}
} catch (Exception e) {
// Nothing
}
return false;
}
}
...
@Override
public boolean onTouchEvent(MotionEvent event) {
if (gestureDetector.onTouchEvent(event))
return true;
else
return false;
}
This works for a FrameLayout, TextView, etc I just can't seem to get
it to work in a WebView, is there some flag I need to enable to allow
the gestures to get through?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---