fragment onCreateView called many times

前端 未结 1 1677
独厮守ぢ
独厮守ぢ 2021-01-17 18:38

I\'m attaching the fragment (many fragments to FrameLayout) of an Activity each fragment has its own view inflated in onCreateView().<

相关标签:
1条回答
  • 2021-01-17 19:44

    Fixed this!!

    Actual problem was with FragmentTransaction for which I'm adding fragments using .add() which causes the view to be populated twice.

    Instead use :

    .replace(R.id.yourId, fragment)

    0 讨论(0)
提交回复
热议问题