如何在NativeScript应用程序中将页面划分为多个部分

如何在NativeScript应用程序中将页面划分为多个部分,nativescript,nativescript-angular,Nativescript,Nativescript Angular,我第一次用NativeScript创建应用程序,我想把屏幕分成两部分,一部分是白色背景,另一部分是圆形角。如果我要创建一个HTML网页,我会使用和Flexbox 在我的NativeScript Angular应用程序中,我是这样做的: <FlexboxLayout flexDirection="column"> <Label height="200px" > </Label> <Label height="1000px" ba

我第一次用NativeScript创建应用程序,我想把屏幕分成两部分,一部分是白色背景,另一部分是圆形角。如果我要创建一个HTML网页,我会使用和Flexbox

在我的NativeScript Angular应用程序中,我是这样做的:

<FlexboxLayout flexDirection="column">

    <Label height="200px" >
    </Label>

    <Label height="1000px" backgroundColor="white" style="border-radius: 80px 80px 0px 0px;"> 

            <Button class="btn btn-primary btn-active" id="button" text="Tap me!"></Button>


    </Label>


</FlexboxLayout>

看起来没问题,但标签上什么也没有。我应该如何划分我的应用程序页面?

这看起来你没有将标签用于正确的目的。根据提供的代码示例,我认为您可能需要类似的东西

<GridLayout rows="200 *" columns="*">
 <Label />
 <GridLayout row="1" backgroundColor="white" rows="*" columns="*" style="border-radius: 80 80 0 0">
    <Button class="btn btn-primary btn-active" id="button" text="Tap me" />
  </GridLayout>
</GridLayout>
标签只能与FormattedString和Span标记一起使用,就像这样

<Label>
   <FormattedString>
        <Span>Some text</Span>
        <Span style="color: blue"> with partial style</Span>
   </FormattedString>
</Label>

GridLayout将是您在Nativescript中最好的朋友,它的性能远远高于FlexboxLayout,因此尽可能使用它。

同时使用设备无关像素可能是一个更明智的选择。Nativescript默认情况下使用此单元,因此删除px就可以了。它的工作方式不符合我的要求-GridLayout的背景不是白色,但透明圆角具有1像素的轮廓。解决这些问题所需的只是更多css。