The specified child already has a parent. You must call removeView"

  When android dynamically loads fragments, the above error will be reported. There is no dynamic addview code in the code, and the problem cannot be found for a long time. In fact, the problem is the inflater.inflate(R.layout.content_fragment, container); function in the onCreateView method has an error.

The inflater.inflate method has a two-parameter method and a three-parameter method. The last parameter of the two-parameter method is automatically filled with true by the system. To modify the above exception, just use the three-parameter method, and use FALSE for the last parameter.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325184424&siteId=291194637