public View inflate (int resource, ViewGroup root, boolean attachToRoot)中 attachToRoot 参数 的理解

官方解释

inflate
added in API level 1

public View inflate (int resource,
ViewGroup root,
boolean attachToRoot)

Inflate a new view hierarchy from the specified xml resource. Throws InflateException if there is an error.

Parameters
resource int: ID for an XML layout resource to load (e.g., R.layout.main_page)

root ViewGroup: Optional view to be the parent of the generated hierarchy (if attachToRoot is true), or else simply an object that provides a set of LayoutParams values for root of the returned hierarchy (if attachToRoot is false.)

This value may be null.
attachToRoot boolean: Whether the inflated hierarchy should be attached to the root parameter? If false, root is only used to create the correct subclass of LayoutParams for the root view in the XML.

Returns
View The root View of the inflated hierarchy. If root was supplied and attachToRoot is true, this is root;

其它诠释
一、
https://*.com/questions/22326314/what-is-the-use-of-attach-to-root-in-layout-inflater

attachToRoot:

attaches the views to their parent (includes them in the parent hierarchy), so any touch event that the views recieve will also be transfered to parent view. Now it’s upto the parent whether it wants to entertain those events or ignore them. if set to false, they are not added as direct children of the parent and the parent doesn’t recieve any touch events from the views.

二、
https://*.com/questions/12567578/what-does-the-layoutinflater-attachtoroot-parameter-mean/45809756#45809756
public View inflate (int resource, ViewGroup root, boolean attachToRoot)中 attachToRoot 参数 的理解