我的手势检测器代码:它是所有简单的预定义代码
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 是此布局的parentView 我的输出动画采用视频格式:Jaggy Scrolling
滚动时是什么导致这种锯齿状?