How to only call onCreateView when fragment is visible?

前端 未结 3 1005
野性不改
野性不改 2020-12-22 09:55

I\'m using a ViewPager with 5 fragments and my problem is that when the first fragment is visible, it already loads the second one.

I read something

3条回答
  •  天涯浪人
    2020-12-22 10:20

    By using this you can give a try,

    @Override
        public void setUserVisibleHint(boolean isVisibleToUser) {
    }
    

提交回复
热议问题