把一个xml文件转化为View对象的几种写法
① View的静态方法 View.inflate (这种方式比较方便)
② 获取LayoutInflater对象 通过LayoutInflater的inflate方法实现
获取LayoutInflater对象方式一 LayoutInflater inflater = LayoutInflater.from(MainActivity.this);
获取LayoutInflater对象方式二 LayoutInflater inflater2 = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
(谷歌源码中采用的这种方式)