ihrupin ihrupin - 4 months ago 27
Android Question

Android: How to scroll ScrollView in top

I have two buttons that switching to the next list of events and the previous one.

When I go to next\previous event, scrolls remains somewhere below. But I need to "rewind" it up.

I'm trying:

scrollViewEventDetails.pageScroll(ScrollView.FOCUS_UP);


and:

scrollViewEventDetails.scrollTo(0, 0);


but it doesn't work. Please, help!

Answer

You shoud write next:

scrollViewEventDetails.fullScroll(View.FOCUS_UP);//if you move at the end of the scroll

scrollViewEventDetails.pageScroll(View.FOCUS_UP);//if you move at the middle of the scroll