Q:

What's the utility of the third argument of View.resolveSizeAndState()?

I went to the official doc page android google official doc, but it seems that they made a serious typo : we have no information about the third argument of the method. So I just wonder if someone already knows how to define this third int argument.

A:

The childMeasuredState is the value returned by View.getMeasuredState(). A layout will aggregate its children measured states using View.combineMeasuredStates(). Here is an example:
int childState = 0;

for (int i = 0; i < count; i++) {
    final View child = getChildAt(i);
    if (child.getVisibility() != GONE) {
        measureTheChild(child);
        childState = combineMeasuredStates(childState, child.getMeasuredState());
    }
}

In most case however you can simply pass 0 instead. The child state is currently used only to tell whether a View was measured at a smaller size than it would like to have. This information is in turn used to resize dialogs if needed. In your particular case you shouldn't worry about it.

