Reputation: 527
I'm trying to make ScrollView automatically scroll to the end of the whole element. I've noticed that
scrollview.setVelocity(-700);
// OR
scrollview.setPosition(1000);
will do the trick, but the amount required to get all the way to the end makes the view jump and go past too fast. If I use a smaller velocity the view will just jitter a bit in place.
Any way to make the view scroll to the end smoothly so that the user can see what's happening?
Upvotes: 0
Views: 412
Reputation: 1406
Was looking for how to stop the bounce on the scrollview and came across this question. It's been a little while so you've probably figured it out but figuring out the height of your scrollview and just using scrollview.setPosition(x) will set the scroll to that position. If you actually want it to "scroll" do scrollview.spring.setAnchor(x); and then set scrollview.setVelocity(x); its the combination of the two that makes it start to scroll. It will stop as soon as you click on the scrollview but thats usually not a bad thing.
Upvotes: 1
Reputation: 297
Scrollview uses a spring internally. Just call setAnchor() to set the scroll target position. The spring will then smoothly moves the scroll area with transition.
Upvotes: 0