1.//context:上下文, resource:要转换成view对象的layout的id, root:一般传null
view = View.inflate(context, R.layout.frist_layout, null);//将一个布局文件转换成一个view对象
2.//通过LayoutInflater将布局转换成view对象
view = LayoutInflater.from(context).inflate(R.layout.frist_layout, null);
3.通过context获取系统服务得到一个LayoutInflater,通过LayoutInflater将一个布局转换为view对象
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.frist_layout, null);