I have a layout which contains button and textView with visibility=”gone”. This layout is child of scrollView. When button has been pressed the textView visibility is set to “visible” but it overflows the screen (this is why it is in scrollView).
My problem is that I’d like to automatically scroll to the end of the page.
So I’ve tried:
mySchrollView.fullScroll(View.FOCUS_DOWN);
But unfortunately it doesn’t work. It seems that layout will be updated after end of the onClick method (and indeed if I call this method again (new click) it is working).
So I need to refresh the layout or screen before calling fullScroll(…); I tried refreshDrawableState() or forceLayout() but it haven’t worked either.
Do you have any idea how to solve it?
Thanks a lot
you can do:
And the fullScroll() will be handled when everything else that is already scheduled (e.g. the layout) is completed.
If this for some reason won’t work, you can use
postDelayed(runnable, 100);(use the same runnable as in the above example), and the view will scroll after 100 milliseconds.