<merge/> Tags are used to reduce the level of the View tree to optimize the Android layout for new projects, without the need to change the run after using the "DDMS, Dump View Hierarchy for UI Automator" tool, Get results The bottom two layers relativelayout and TextView are the contents of the Activity_main.xml layout, the framelayout above is the top-level view added by activity Setcontentview. The following using the Merge tab can see the difference only need to change the relativelayout to a merge framelayout below is directly textview, compared with the previous one less than a layer of relativelayout and achieve the same effect. What happens when you consider using the merge label?
One is that, as in the example above, the child view does not need to specify any layout properties for the parent view, in the example TextView just needs to be added directly to the parent view for display on the line.
The other is that if you need to embed a layout (or view) inside the LinearLayout, and the root node of the layout (or view) is also linearlayout, so that there is a layer of unused nesting, it is no doubt that this only slows down the program speed. And at this point, if we use the merge root tag to avoid that problem, the official document Android Layout Tricks #3: Optimize by the example in merging demonstrates this situation.
Note: <merge/> can only be used as the root tag of an XML layout. When you inflate a layout file that begins with <merge/>, you must specify a parent ViewGroup, and you must set Attachtoroot to True.
Merge Optimized layout