How do I get the child View of a ViewPager at a given item

后端 未结 5 443
北恋
北恋 2020-12-05 17:54

I\'ll keep the question as short and simple as humanly possible.

View activeView = mViewPager.getChildAt(mViewPager.getCurrentItem());

retu

5条回答
  •  不知归路
    2020-12-05 18:50

    How many child views should the be?

    Also a ViewPager doesn't have all childs loaded at the same time. Only the one it is showing and the next one. You can use mViewPager.setOffscreenPageLimit() to, for example 3 or 4, to 'preload' more items into the viewpager.

提交回复
热议问题