My Gesture Detector Code: It's all Simple pre-defined code
private final GestureDetector.SimpleOnGestureListener mGestureListener
= new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onDown(MotionEvent e) {ViewCompat.postInvalidateOnAnimation(FractionalLinearLayout.this);
return true;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2,
float distanceX, float distanceY) {
/**
* Pixel offset is the offset in screen pixels, while viewport offset is the
* offset within the current viewport. For additional information on surface sizes
* and pixel offsets, see the docs for {@link computeScrollSurfaceSize()}. For
* additional information about the viewport, see the comments for
* {@link mCurrentViewport}.
*/
Log.d("Testing Scroll", ""+distanceY);
if(mParentView != null && mParentView.getId() == R.id.container && (distanceY>10 || distanceY<-10)){
mParentView.scrollBy(0, (int)distanceY);
}
ViewCompat.postInvalidateOnAnimation(FractionalLinearLayout.this);
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
mScroller.fling(getScrollX(), getScrollY(),
-(int) velocityX, -(int) velocityX, 0, 0, 0, 0);
ViewCompat.postInvalidateOnAnimation(FractionalLinearLayout.this);
return true;
}
};
mParentView is the parentView of this layout And my Output Animation in Video format : Jaggy Scrolling
what is causing such jaggedness in my scrolling?