Question

I've got a scrollview that is on a Fragment that is on a ViewPager and I want to scroll it to some position on start, after pager.setCurrentItem(numberOfPage); where numberOfPage is a remembered last page.

So , if I do scrollTo() in a Fragment onCreateView() - it wouldn't scroll anywhere because it just creates view and not yet inflate it, so it doesn't scroll

I would of scroll it in a onPageSelected(int position) in Activity, but it works only on manually selected ViewPager's fragment and I'm setting it in the beginning as I already mentioned.

So, how can I scroll it right after Inflation?

Was it helpful?

Solution

Call scrollTo() method in Fragments onViewCreated()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top