1

I need to listen to the scroll of a ScrollView. In order to do that I extended the ScrollView overriding its onScrollChanged(int, int, int, int).

When the view scrolls I move another view along with that scroll, and all is ok. When I release the view while scrolling, the ScrollView still scrolls with an inertia effect (smooth scroll). The problem is that, after the release, the method onScrollChanged is called after the view is invalidated, the effect is that my view is moved after a small delay with an ugly effect.

In order to avoid this I could disable the smooth scroll from the ScrollView. But, is there a way for listening for the smooth scroll and continuing moving the view also during the residual scroll?

1 Answer 1

1

I didn't test it but it's a different way of getting scroll position change.

scrollView.getViewTreeObserver().addOnScrollChangedListener(listener); 

this listener is a simple interface:

public void onScrollChanged(){ scrollView.getscrollY(); // value is here } 
Sign up to request clarification or add additional context in comments.

1 Comment

I found that overriding ScrollView's onScrollChanged was a better solution, but both these two solutions do not solve my problem... thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.