Reputation: 32233
I want to programmatically scroll a view within the scrollview. I can do this making:
View viewToShow= ...
ScrollView scrollView= ...;
scrollView.scrollTo(0,viewToShow.getTop());
But it only works if the layout has been measured. The result of viewToShow.getTop()
within onCreate() is 0 always, so it does not work.
How can I solve it? Thanks
Upvotes: 0
Views: 104
Reputation: 1667
override:
public void onWindowFocusChanged (boolean hasFocus)
In this function, layout values are calculated (margin included)
Upvotes: 1