zoukankan      html  css  js  c++  java
  • fragment The specified child already has a parent. You must call removeView()

    在切换Fragment的时候出现:The specified child already has a parent. You must call removeView()异常。

    错误主要出在Fragment中的oncreateview方法中。

    可能引起错误的写法:

    View view = inflater.inflate(R.layout.indexfragment_layout, container);
    

      正确写法:

    View view = inflater.inflate(R.layout.indexfragment_layout, container,
    				false);
    

      具体原因暂不详,希望知道的同学告知一下,谢谢。

  • 相关阅读:
    Java基础知识整理
    HashMap源码解读(JDK1.7)
    书籍列表
    mysql4
    mysql3
    mysql2
    mysql1
    数据结构4
    数据结构3
    数据结构2
  • 原文地址:https://www.cnblogs.com/tony-yang-flutter/p/4414902.html
Copyright © 2011-2022 走看看