一、View.inflate() 和异步 inflater 的区别
View.inflate()
和异步 LayoutInflater
(后文简称为异步 inflater
)都是用于将 XML
布局文件转换为 View
对象的方法。
它们的区别在于执行过程和性能表现。
1.1 View.inflate()
View.inflate()
是 View
类中的一个静态方法,用于从 XML
布局文件创建 View
对象。它的源码如下:
public static View inflate(Context context, @LayoutRes int resource,