0

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?

Adrian Heine
  • 4,051
  • 2
  • 30
  • 43
Vlad Alexeev
  • 2,072
  • 6
  • 29
  • 59

1 Answers1

3

Call scrollTo() method in Fragments onViewCreated()

Hassan Jawed
  • 1,650
  • 1
  • 12
  • 19