I have a ListView
that captures swipe gestures to delete a row. This ListView
lives in a Fragment
. On phones this is in it's own Activity
and works great. On tablets this Fragment
is in a ViewPager
and the ListView
is never able to capture any of the the swipe events since they always go to the ViewPager
.
How would I go about making sure swipe gestures are captured by the ListView
to consume before they are passed to the ViewPager
?
P.S.
I am using this library for my swipe to dismiss gestures in my ListView
Create a subclass of
ViewPager
and overridecanScroll()
. If the suppliedView
is theListView
, returntrue
to have the touch events be given to theListView
.For example, here is a class I use in some samples for hosting maps in a
ViewPager
:Now, it is entirely possible that there may be more to getting your swipe-to-dismiss to work inside the
ViewPager
, but I would start here.