做项目时发现两个 :
View.inflate(
Context context,
int resource,
ViewGroup root);还有LayoutInflater.inflate(),四个;
不知道有什么区别,点进View.inflate()方法看发现源码如下:
public static View inflate(Context context, int resource, ViewGroup root) {
LayoutInflater factory = LayoutInflater.from(context);
return factory.inflate(resource, root);
}
实则调用LayoutInflater的方法。
另LayoutInflater的四种inflate()方法区别及注意事项参见以下两篇文章
http://blog.csdn.net/zhaokaiqiang1992/article/details/36006467?utm_source=tuicool&utm_medium=referral
http://blog.jobbole.com/72156/