【问题标题】:Multiple fullscreen in scrollview with Nativescript带有 Nativescript 的滚动视图中的多个全屏
【发布时间】:2020-08-15 11:21:10
【问题描述】:

我想知道如何使用 nativescript 在滚动视图中实现多个全屏?

我试过这个:

<Page actionBarHidden="true" class="page">
    <ScrollView orientation="vertical">
        <StackLayout>
            <StackLayout height="100%" backgroundColor="red">
<Label text="Fullscreen 1"></Label>
            </StackLayout>

            <StackLayout height="100%" backgroundColor="blue">
<Label text="Fullscreen 2"></Label>
            </StackLayout>
        </StackLayout>
    </ScrollView>
</Page>

但堆栈不是全屏的。

【问题讨论】:

    标签: nativescript nativescript-vue


    【解决方案1】:

    我解决了这个问题:

    模板

    <Page actionBarHidden="true">
        <ScrollView orientation="vertical">
            <StackLayout>
                <StackLayout :height="screenHeight" backgroundColor="red">
                    ...
                </StackLayout>
    
                <StackLayout :height="screenHeight" backgroundColor="blue">
                    ...
                </StackLayout>
            </StackLayout>
        </ScrollView>
    </Page>
    

    并添加:

    import { screen } from "tns-core-modules/platform";
    
    ...
    data() {
        return {
            screenHeight: 0
        };
    },
    ...
    created() {
        this.screenHeight = screen.mainScreen.heightDIPs
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-27
      • 2014-06-03
      • 1970-01-01
      • 2020-04-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多