WeixinFragment的onCreateView()
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
????return inflater.inflate(R.layout.tab01, container,false);
}
inflage()傳入三個(gè)參數(shù)就可以,若傳入兩個(gè)return inflater.inflate(R.layout.tab01, container);就會(huì)報(bào)錯(cuò):Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. 這是什么原因呢?
2015-12-30
你傳入inflater.inflate(R.layout.tab01, container);的話,內(nèi)部它會(huì)調(diào)用inflater.inflate(R.layout.tab01, container,container != null);返回的是container并不是xml布局所生成的View對(duì)象