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

时间:2019-05-07 20:46:37

标签: nativescript nativescript-angular

我第一次使用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>

看起来不错,但此标签上没有任何内容。我应该如何划分我的应用页面?

1 个答案:

答案 0 :(得分:1)

这似乎是您没有将标签用于正确的目的。我想根据所提供的代码示例,您会想要这样的东西。

<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性能要好得多,因此请尽可能使用它。