0

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

1 Answer 1

1

override:

 public void onWindowFocusChanged (boolean hasFocus)

In this function, layout values are calculated (margin included)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.