I am studying adding flashing (not color changes) to my project, but even after reading the API docs and a few questions here, I still donβt understand what I need to do to get it working.
According to the OverScroller API: βThis class encapsulates scrolling with the ability to exceed the scroll borders. This class is a replacement for the scroller in most cases.β
I had a Scroller object before in my parent class:
public boolean onTouchEvent(MotionEvent ev) { ....
And I decided to change it to this:
if (deltaY != 0 || deltaX != 0) overScrollBy(deltaX, deltaY, getScrollX(), getScrollY(), child.getRight() - getWidth(), child.getBottom() - getHeight(), OVERSCROLL_DISTANCE, OVERSCROLL_DISTANCE, false);
And now scrolling doesn't work at all! fling() works fine as a replacement, but not scrolling ....
In conclusion, I have two questions:
- Why doesn't scrolling work with
overScrollBy ? Should I add extra code to make this work? - Why should I call
mScroller.fling() and only overScrollBy() ? Why not mScroller.overScrollBy() ? Is it somehow built into the View class?
This may be potentially obvious, but I'm afraid here. Any help would be greatly appreciated, thanks!
source share