Nativescript折叠的GridLayout行仍在UI中发生

Nativescript折叠的GridLayout行仍在UI中发生,nativescript,Nativescript,使用此布局: <GridLayout columns="70, *" rows="auto, auto, auto"> <Label row="0" col="0" rowSpan="3" text="A" style="background-color: red;"></Label> <Label row="0" col="1" text="B" style="background-color: green;"></La

使用此布局:

<GridLayout columns="70, *" rows="auto, auto, auto">

    <Label row="0" col="0" rowSpan="3" text="A" style="background-color: red;"></Label>

    <Label row="0" col="1" text="B" style="background-color: green;"></Label>
    <Label row="1" col="1" text="C" visibility="collapse" style="background-color: blue;"></Label>
    <Label row="2" col="1" text="D" style="background-color: orange"></Label>

</GridLayout>

我能看到B行和D行之间的空白有什么原因吗?我希望D排上升,取代C排

我正在一台物理设备上进行测试,下面是结果的简要描述:

我希望结果的行为类似于以下html表:

<table>
    <tbody>
        <tr>
            <td rowspan="3" style="width: 70px; background-color: red;">A</td>
            <td style="width: 500px; background-color: green;">B</td>
        </tr>

        <tr>
            <td style="display: none; background-color: blue;">C</td>
        </tr>

        <tr>
            <td style="background-color: orange;">D</td>
        </tr>
    </tbody>
</table>

A.
B
C
D
下面是html结果的一个片段:

这是因为您定义了一个包含3行的GridLayout,并将标签D设置为第三行。即使标签C被折叠,它的位置也不会被占据

如果您想要与第二张图片完全相同的布局,那么我建议:

<GridLayout columns="70, *" rows="auto">
    <Label row="0" col="0" text="A" style="background-color: red;"></Label>
    <StackLayout row="0" col="1">
        <Label text="B" style="background-color: green;"></Label>
        <Label text="C" visibility="collapse" style="background-color: blue;"></Label>
        <Label text="D" style="background-color: orange"></Label>
    </StackLayout>
</GridLayout>


p/s:如果您将标签C恢复为可见,布局也将调整自身大小

有意义。。。我忘记了,因为它是在GridLayout本身中定义的,所以无论发生什么情况,它都会坚持3行。我会按照你的建议进行堆栈布局,谢谢!