I avoided using GestureDetector and SimpleOnGestureListener, I done it with catching touch listnerby catching the position fron MotionEvent.ACTION_DOWN and MotionEvent.ACTION_UP
Disable long click in android webview
-
14-04-2022 - |
Question
I am using css columns to display contents in android webview. I used longclicklistner {return true}; with this I was able to disable longclick in phones but it doesn't seem to work in tabs(eg galaxy tab 2). I'm also preventing touchmove event using jquery but the css columns are moving when swipe occurs as part of longclick. Any help is welcome. Thank you.
wbView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
});
wbView.setLongClickable(false);
jquery code:
document.getElementById("divIdToShowContent").ontouchmove = function(e){
e.preventDefault();
var touching = null;
}
La solution 2
Autres conseils
You have to use a GestureDetector
, the SimpleOnGestureListener
has onSingleTapConfirmed()
for click events and onFling()
for swipe events.
Refer this
Try this :
_webview.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
});
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow