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);

 

相关文章:

  • 2022-12-23
  • 2021-12-14
  • 2021-05-08
  • 2021-08-29
  • 2022-02-08
  • 2021-11-07
  • 2021-07-30
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2021-12-04
  • 2021-05-27
  • 2022-12-23
  • 2021-12-26
相关资源
相似解决方案