javascript - Nativescript ScrollView 不滚动

标签 javascript android ios vue.js nativescript

我是 Nativescript 开发的新手,我有一个由 GridLayout 包裹的 ScrollView,在 ScrollView 中我放置了各种 StackLayout,但是滚动布局根本不起作用,其中一个堆栈布局(黄色)显示为居中,知道我的代码有什么问题吗?

<template>
<Page class="background-color:white;">
    <ActionBar class="bg_blue_marine">
    </ActionBar>
    <GridLayout rows="*,auto" columns="*" style="width:100%; height:100%;">
        <ScrollView row="0" col="1" orientation="vertical" style="width:100%; height:auto; background-color:rgb(200,200,200);">
            <StackLayout style="width:100%; height:400px; background-color:red;"></StackLayout>
            <StackLayout style="width:100%; height:400px; background-color:yellow;"></StackLayout>
        </ScrollView>
        <FlexBoxLayout row="1" col="1" style="width:100%; height:80px; align-items:center; justify-content:space-around; background-color:white;"></FlexBoxLayout>
    </GridLayout>
</Page>
</template>

最佳答案

<GridLayout rows="300,*" columns="*">
        <ScrollView height="300" orientation="vertical">
    <StackLayout orientation="horizontal" horizontalAlignment="center" row="0" col="0" style="background-color:rgb(200,200,200);">

            <StackLayout orientation="horizontal" horizontalAlignment="center"
                style="width:50%; height:400; background-color:red;"></StackLayout>
            <StackLayout orientation="horizontal" horizontalAlignment="left"
                style="width:50%; height:400; background-color:yellow;"></StackLayout>
    </StackLayout>
</ScrollView>

    <FlexBoxLayout row="1" col="0"
        style="width:100%; height:80; align-items:center; justify-content:space-around; background-color:white;">
    </FlexBoxLayout>
</GridLayout>

将提供以下结果[1]:/image/m4TAG.png

我不确定是否可以将 ScrollView 作为 GridLayout 的一行,您应该使用任何布局。另外,高度和宽度不能使用 px 单位。另外,每当使用 StackLayout 时,请使用“方向”和“对齐”属性。

关于javascript - Nativescript ScrollView 不滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59012473/

相关文章:

ios - 只在某些特定的 ViewController 中启用横向

javascript - d3 js基本折线图,数据问题

javascript - Head First JavaScript 中关于 Javascript 练习的问题

javascript - 为什么 webpack 在生产模式下会忽略 chunk?

c# - 如何在 Spinner 中选择项目并将其用作字符串?

java - OkHttp 中的 setEntity 等效项 - Android

java - 如何在 libGDX 中绑定(bind)缩放?

javascript - 将类添加到存储在数组中的元素的更简洁的方法?

ios - 等待 block 完成以重新加载 UITableView 数据

ios - value 不为零,但在解包可选值时意外发现 nil