Search code examples
androidscrollview

ScrollView does not come back to the beginning of layout - Android


How do I make a ScrollView always come back to the beginning? I have a ScrollView, and inside it a LinearLayout (vertical) with a TextView and a Button called "next". This button changes the TextView text, however the text is not shown at the beginning, but always of where it was visible on screen when the button was clicked. The user then has to scroll to see the beginning of the text.

Is there a way to make the ScrollView go back to the begging when the button is clicked?

Thank you


Solution

  • Just call scrollTo(0,0) on your Scrollview.