1. fragment动态填充时,布局没有按指定格式填充 解决方案:inflater.inflate(R.layout.fragment,container); 之前在写这个方法返回view的时候,第二个参数一般填的都是null,改为CreateView提供的 ViewGroup即可。 2.The specified child already has a parent. You must call removeView() on the child's parent first. 解决方案: inflater.inflate(R.layout.fragment,container);,添加一个参数 inflater.inflate(R.layout.fragment,container,false); 3.继承fragment类的时候不要添加带参的构造方法,否则在打包apk的时候会报错,调试的时候倒是没问题。