Reputation: 13
The question is pretty much self explanatory but I was wondering how to see the center part of the HorizontalScrollView when it first appears on the screen. It would display exactly as if you had scrolled to the center of the view.
So far I have tried:
scrollView.scrollTo(x, y);
Where 'y' has been 0 and 'x' has been half the width of the contents of scrollView.
Any help would be greatly appreciated
Thanks,
Evan
Upvotes: 1
Views: 90
Reputation: 1494
You have to use:
scrollView.post(new Runnable() {
@Override
public void run() {
scrollView.scrollTo(x, y);
}
});
Upvotes: 1