NativeScript StackLayout问题-如何将百分比设置为宽度和高度?

NativeScript StackLayout问题-如何将百分比设置为宽度和高度?,nativescript,Nativescript,我正在尝试使用STACKLAYOUT设计一个简单的布局。我希望布局为四个部分,如下图所示: 1,收割台高度为75px,宽度为100%。 页脚也为75px,100%宽度 3#4,这两个都将占剩余空间的50%。 我的无效代码 <StackLayout orientation="vertical" width="100%" height="50%" backgroundColor="lightgray

我正在尝试使用STACKLAYOUT设计一个简单的布局。我希望布局为四个部分,如下图所示:

1,收割台高度为75px,宽度为100%。 页脚也为75px,100%宽度 3#4,这两个都将占剩余空间的50%。 我的无效代码

<StackLayout orientation="vertical" width="100%" height="50%"
            backgroundColor="lightgray">
            <Label text="Label 1" backgroundColor="red"
                horizontalAlignment="stretch" height="75"/>
            <Label text="Label 3" 
                backgroundColor="green" />
            <Label text="Label 4"
                backgroundColor="blue" />
            <Label text="Label 2"  height="75"
                backgroundColor="yellow" horizontalAlignment="stretch" />
        </StackLayout>


因此,为了澄清,我希望页眉在顶部,页脚在底部,剩余的中间空间平均分配

有人能帮我吗?我尝试了这么多以上代码的组合,但它始终无法正确显示

谢谢你检查这个问题


John

我建议在这里使用GridLayout,您确实不想堆叠项目,而是为所有项目相应地分割空间,所以请尝试

<GridLayout rows="75,*,*,75" backgroundColor="lightgray">
    <Label row="0" text="Label 1" backgroundColor="red" />
    <Label row="1" text="Label 3" backgroundColor="green" />
    <Label row="2" text="Label 4" backgroundColor="blue" />
    <Label row="3" text="Label 2" backgroundColor="yellow" />
</GridLayout>