天天看点

Android之LayoutInflater

resource : 它是要解析的XML文件的id号(必填)

root : 如果传入不为空, attachToRoot也为true, 就把XML解析后的view加入root子控件, 然后返回这个root;否则, 就返回一个解析之后的XML生成的view.

attachToRoot : 决定是否让root成为返回值的父控件

view=inflater.inflate(R.layout.news_content_frag,container,false);

参考资料:LayoutInflater.from(this).inflate()方法参数解析