• 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);
    

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

  • 相关阅读:
    ajax01
    django04
    数据库
    WeakHashMap类
    IdentityHashMap
    Hashtable类
    LinkedHashMap类
    HashMap和TreeMap类
    PriorityQueue
    Synchronized
  • 原文地址:https://www.cnblogs.com/tony-yang-flutter/p/4414902.html
Copyright © 2020-2023  润新知