How to solve for viewpager : The specified child already has a parent. You must call removeView() on the child's parent first

后端 未结 8 1595
半阙折子戏
半阙折子戏 2020-12-04 18:05

Into my project I am using viewpager with three tabs named History,Main,Map.Main activity contain Timer,stopwatch,etc

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 18:35

    For a adapter if you are using with tabLayout or viewPager, instead of getChildFragmentManager() replace it with getActivity().getSupportFragmentManager() like below.

    TabAdapter adapter = new TabAdapter(getActivity(), getActivity().getSupportFragmentManager());

提交回复
热议问题