Skip to content

onlayout在存在隐藏的子元素的时候计算错误 #3

@windern

Description

@windern

不能再for循环后直接i++,因为如果遇到隐藏的子元素了,就跳过了,如果i++了,就这一行也会少显示一个元素,这是不对的,应该在最后成功了才i++
for (int i = 0; i < childNumInRow; ) {
View child = getChildAt(childIdx++);
if (child.getVisibility() == GONE) {
continue;
}
XXXXXX
XXXXXX
//可以显示的才算这一行的元素,成功以后才i++
i++;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions