Content from: http://blog.csdn.net/lovexieyuan520/article/details/9036673
Many people on the Internet Ask Layoutinflater class usage, and the meaning of the inflate () method parameters, are explained as follows:
The role of inflate () is to find a layout file defined in XML, noting the difference between Findviewbyid (), inflate is loading a layout file, and Findviewbyid is looking for a control from the layout file.
1. There are three ways to get Layoutinflater objects
Layoutinflater Inflater=layoutinflater.from (this);
Layoutinflater Inflater=getlayoutinflater ();
Layoutinflater inflater= (Layoutinflater) This.getsystemservice (Layout_inflater_service);
2. Aboutthe meaning of three parameters of Layoutinflater class inflate (int resource, ViewGroup root, Boolean Attachtoroot) method
Resource: The ID of the layout file needs to be loaded, meaning that the layout file needs to be loaded into the activity to operate.
Root: The root control that needs to be attached to the resource resource file, what does it mean that inflate () returns a View object, and if the third argument is Attachtoroot true, the root is returned as the root object, Otherwise, simply append the Layoutparams attribute of the root object to the root layout object of the resource object, which is the outermost view of the layout file resource, such as a linearlayout or other layout object.
Attachtoroot: Whether to attach root to the root view of the layout file
This is my understanding, if you do not understand or wrong, please the vast numbers of netizens to my message, common progress!