关于LayoutInfalter.infalte方法的三个参数

LayoutInflater.infalte(int resId, ViewGroup root , boolen attachToRoot);

root:传入且不为null的话,且attachToRoot为true,那么返回的是包含resId布局的root布局。

如果传入,且attachToRoot为false的话,那么root的作用仅仅是为resId布局提供LayoutPrarms参数,也就是说如果root为null,那么resId布局里面设置的宽高,margin等LayoutPrarms参数是没有意义的,而且返回的view仅仅是resId的布局。

调用inflate(int resId, ViewGroup root )等于调用 inflate(resId, root, root != null);

你可能感兴趣的:(关于LayoutInfalter.infalte方法的三个参数)