关于Android fragment的一些问题
在加载fragment布局的时候如果给其加上viewgroup,则在该fragment依赖的活动中进行replace时会出现Android: java.lang.IllegalStateException: The specified child already has a parent错误,为了解决这个问题,可以在活动中移除child,也可以在初始化fragment时给其设置parent为null。
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_student, **null**);//container
return view;
}
#仅仅是为了记录一些自己在写代码的过程中遇到的问题,方便以后查阅。太菜了,还需要努力啊!!!!!