I have a TextView inside a ScrollView. I have used the below code to scroll programmatically.
mScrollView.post(new Runnable() {
public void run() {
mScrollView.scrollTo(0, mScrollView.getBottom());
}
});
It does fine. Now But I want to control the scrolling speed of scrollview in differend speed values. How to get it?
Or you can animation for smooth scrolling
ObjectAnimator animator=ObjectAnimator.ofInt(yourScrollView, "scrollY",targetYScroll );
animator.start();
After few searches, this is what worked for me. Here is the code I used to slow down the scroll speed of ScrollView programmatically,
ObjectAnimator anim = ObjectAnimator.ofInt(mScrollView, "scrollY", mScrollView.getBottom());
anim.setDuration(9000);
anim.start();
mScrollView - Your ScrollView
mScrollView = (ScrollView) findViewById(R.id.scrollView1);
anima.setDuration(int Value) - greater the value, slower the scroll I used the code block in Switch Button OnCheckedChangedListener.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With