Its function is to inform that the view or layout should be sized enough to show all its contents, including any paddind defined.
How it works.
The layout design is processed into two passages: "measurement" and "positioning".
Each of the passages runs through the "view tree" from top to bottom.
During the "measurement" passage each view in the "tree" informs its size specifications and calculates its size. At the end all views have saved their dimensions.
The "measurement" passage uses the class Viewgroup.Layoutparams to communicate dimensions. It is used by "children" objects to tell "parents" how they want to be measured and positioned. The Viewgroup.Layoutparams base class only describes how large the view wants to be for both width and height.
For each dimension, it specifies one of the following values::
- An exact number.
- MATCH_PARENT, which means the view wants to be as big as the parent (less padding)
- WRAP_CONTENT, means the view wants to be large enough to include its content (more padding).
During the "positioning" passage each "parent" view is responsible for positioning each "child" using the calculated sizes in the "measuring passage".