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

后端 未结 8 1601
半阙折子戏
半阙折子戏 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:36

    // if the child view to be added is already bound to a parent, then remove the child from the parent and then add again to the container.

    if (v.getParent() != null) {
      ((ViewGroup) v.getParent()).removeView(v);
    }
    container.addView(v);
    

提交回复
热议问题