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

后端 未结 5 442
北恋
北恋 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:34

    Your view pager adapter is holding maximum of 2 pages, i.e 2 views/fragments, the rest of them are recycled. In other case, what you did not mentioned is that you might have 2 pages/views in the ViewPager.

    Please look at mViewPager.setOffscreenPageLimit()

提交回复
热议问题