2

Im trying to implement Swipe ListView open source library by 47Deg inside a fragment of ViewPager. I tried this library in simple Activity and it work flawless. References to this library are follow:

Library GitHub

Tutorial

YouTube Tutorial

Senario

As I mentioned I want to implement it inside fragment of ViewPager but when I swipe on item of a list the view page slides away. I wanted to wipe list item when list item is touched and swipe fragment otherwise.

What I have already done

I created a custom class CustomViewPager extends ViewPager{} and disabled the swipe on touch by using the solution provided HERE. I also tried tweaking around with onTouch, Clickable tags and other thing which I could do best as I'm a newbie.

Help me regarding this issue.

Community
  • 1
  • 1
Bilal Rabbani
  • 1,288
  • 14
  • 24

1 Answers1

5

in class class SwipeListViewTouchListener in method public boolean onTouch(View view, MotionEvent motionEvent) { I added view.getParent().requestDisallowInterceptTouchEvent(true); and it works for me. Give it a try may be it works for you too.

Omid Aminiva
  • 667
  • 5
  • 14
  • actually adding this in onTouch(...) at the end of if (allowSwipe && rect.contains(x, y)) statement right before break; is better since it will allow swiping if the list takes the entire fragment but its element don't fill the entire space and we click in that empty space – Piotr Zawadzki Jan 28 '15 at 10:01