I have one layout in which i have used ScrollView. Now I have also implemented 'CustomScrollView' so that i can filter Swipe action that view.
Here is my custom ScrollView :
public class CustomScrollView extends ScrollView { private GestureDetector mGestureDetector; public CustomScrollView(Context context, AttributeSet attrs) { super(context, attrs); mGestureDetector = new GestureDetector(context, new YScrollDetector()); setFadingEdgeLength(0); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return super.onInterceptTouchEvent(ev) && mGestureDetector.onTouchEvent(ev); } // Return false if we're scrolling in the x direction class YScrollDetector extends GestureDetector.SimpleOnGestureListener { @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return Math.abs(distanceY) > Math.abs(distanceX); } } } Now I have also implemeted GestureDetector. On swiping view vill call onFling 80/100 times.
Can I have some suggestions so that i can implement more accurate swipe behaviour.?
Thanks.!!