I have a scroll view with a linear layout inside, which contains many text boxes.
Now I'm trying to build up an automatic scrolling, but I can't get the current scroll position of the layout.
How is this possible?
Thanks in advance
Check out this answer, I think it's the thing you're looking for:
https://stackoverflow.com/a/3035521/375929
Edit:
How about doing this:
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putInt("scrollX", scrollView.getScrollX());
outState.putInt("scrollY", scrollView.getScrollY());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
int scrollX = savedInstanceState.getInt("scrollX"); // Defaults to 0
int scrollY = savedInstanceState.getInt("scrollY");
scrollView.scrollTo(scrollX, scrollY);
}