Android – Custom scroll effect for scrollview


Anybody that knows how to make my own scrolling function like fling() or smoothScrollTo()?
I have a class that is ScrollView extended but I cant find out how to make this…

I want it to work like fling but backwards, with that I mean instead of slowing down from a given velocity I want it to accelerate from 0 in the same rate as it slows down on fling and then stop scrolling at a given position…

the effect Im aiming at is like the WP7 lockscreen, you throw it off the screen upward, if your scrollview havent scrolled all the way to the end I want it to "fall down" and there for I want it to start at velocity 0 and increase until it hits the start position again.

Anybody that could help me or just point me in the right direction?

Best Solution

You might be able to get the effect you are looking for by setting a different Interpolator on the scroller.

For instance, you could try using an AccelerateInterpolator.


Scroller myScroller = new Scroller(context, new AccelerateInterpolator());

EDIT: Be sure to read bigstones answer though, as my suggestion doesn't help unless you are willing to create your own ScrollView (which isn't all that hard since you have the source).