什么是View.resolveSizeAndState的)第三个参数(的效用?效用、第三个、参数、View

由网友(萌心菇凉)分享简介:我去官方文档页面android谷歌官方文档,但似乎他们做了一个严重的错字:我们没有关于该方法的第三个参数信息。所以,我只是想知道是否有人已经知道如何定义这个第三个int参数。I went to the official doc page android google official doc, but it seem...

我去官方文档页面android谷歌官方文档,但似乎他们做了一个严重的错字:我们没有关于该方法的第三个参数信息。所以,我只是想知道是否有人已经知道如何定义这个第三个int参数。

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.

推荐答案

childMeasuredState View.getMeasuredState()。布局将整合其孩子使用 View.combineMeasuredStates测量状态()。下面是一个例子:

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());
    }
}

在大多数情况下,但是你可以简单地通过0代替。孩子状态目前仅用于被告诉查看是否是衡量一个更小的尺寸比它想拥有。此信息交替使用,如果需要调整对话框。在特定的情况下,你不应该担心。

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.