I was wondering if there's a way to ignore buttons on the view pager when swiping. For instance, I have a panel of buttons located at the bottom of the screen and the users may swipe left or right to display more of the buttons available. The problem I'm having is that the margins between the buttons a relatively small compared to the buttons themselves so more often than not I'm on a button when swiping, which the viewpager does not respond to so I have to go back and try and get inbetween the buttons with my finger and then swipe. Is there a way to prevent this from happening?
Asked
Active
Viewed 95 times
1
-
1do you have SimpleOnGestureListener -- if you do then there are Public Methods to listen clicks, taps, i believe (onContextClick) or (onSingleTapConfirmed) and then send that info to the click''s to prevent its default behaviour. Something like that anyway -- http://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener.html – Tasos Sep 15 '15 at 22:52
-
Where would I put this SimpleOnGestureListener? Currently I'm using the default viewpager which handles swipe-events for me. I'm relatively new to android to be honest and as my background is in C# - I'm literally on a foreign planet, so any examples you could give would be appreciated. Also, do I need to have this on the viewpager or for each button? – Eidenai Sep 15 '15 at 23:06
-
1Just have a look at some questions on SO for SimpleOnGestureListener. - http://stackoverflow.com/questions/4952556/mygesturedetector-extends-simpleongesturelistener – Tasos Sep 15 '15 at 23:11
-
Thanks Brother. Hopefully that's what I need. From the looks of it, you're spot on. – Eidenai Sep 15 '15 at 23:13
-
1Yeah, sorry i had the code but i removed it recently from my project. i used it for a viewpager too -- check here also, thats were i got the code-- https://developer.android.com/training/gestures/detector.html – Tasos Sep 15 '15 at 23:15