本質上是一樣的,題主可以查看Android源代碼:
我們看下View類inflater方法的代碼:其實方法內本質還是在調用inflater.inflater方法
我們看下View類inflater方法的代碼:其實方法內本質還是在調用inflater.inflater方法
public static View inflate(Context context, @LayoutRes int resource, ViewGroup root) {
LayoutInflater factory = LayoutInflater.from(context);
return factory.inflate(resource, root);
}
前者是後者的封裝,後者是一切view解析的根基
前者是後者的封裝,後者是一切view解析的根基