本文介绍了什么是View.resolveSizeAndState的)第三个参数(的效用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我去官方文档页面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.

这篇关于什么是View.resolveSizeAndState的)第三个参数(的效用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 13:11