Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable onclick listener while swiping a view in android?

Tags:

android

I have a view that can be swiped to another page. It has an onClick listener, which displays a dialog box.

The problem is, swiping triggers both actions (i.e. It shows the next page and the dialog box).

How can I disable the onClick listener when swiping.

like image 444
Shyam Avatar asked Feb 19 '23 13:02

Shyam


1 Answers

It sounds like you want to use a GestureDetector (as well), the SimpleOnGestureListener has onSingleTapConfirmed() for click events and onFling() for swipe events.

like image 132
Sam Avatar answered Apr 29 '23 04:04

Sam