Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reset scroll in ScrollView

I have a ScrollView (and a LinearLayout within it) set as main content. When the user scrolls the view further down, and then if I replace it's child (LinearLayout) with another LinearLayout, the view remains in the scrolled positioned.

How do I reset the ScrollView back to coordinate 0?

like image 894
ankitjaininfo Avatar asked Sep 17 '10 12:09

ankitjaininfo


3 Answers

Why not just use scrollTo(0, 0);?

Link: http://developer.android.com/reference/android/view/View.html#scrollTo(int%2C%20int)

like image 130
Rachel Z Avatar answered Oct 10 '22 06:10

Rachel Z


If u want to clear the scrollview u can use removeAllViews();

like image 20
gran33 Avatar answered Oct 10 '22 06:10

gran33


Its all in the documentation... http://developer.android.com/reference/android/widget/ScrollView.html search for fullScroll(int)

like image 45
WarrenFaith Avatar answered Oct 10 '22 08:10

WarrenFaith