What is the best way to add fragment in the Tabs android

后端 未结 4 616
南方客
南方客 2021-01-17 00:17

My application had a bottom navigation bar which has 5 tabs. So according to these tabs, I have 5 fragments When I click on the tab, the fragment changed according to that t

4条回答
  •  囚心锁ツ
    2021-01-17 00:46

    Using ViewPager with FragmentPagerAdapter suits for you in this case.

    Then use ViewPager#setOffsetPageLimit(5). This will help you show/hide your fragments without recreating it again.

    Follow this tutorial

    Let try it, then tell me if your problem is solved or not. ;)

提交回复
热议问题