android中获取打气筒的几种方式

1,简单说明,打气筒就是将我们的xml布局转换为我们的view对象,不扯远了,直接看代码

1 A:从context中获取
2 LayoutInflater inflater1 = LayoutInflater.from(this);
3 B:通过Activitiy直接获取
4 LayoutInflater inflater2 = this.getLayoutInflater();
5 C:根据SystemService获取资源
6 LayoutInflater inflater3 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
原文地址:https://www.cnblogs.com/wjtaigwh/p/4912197.html