【问题标题】:ScrollView inside ListView using ng-template issue使用 ng-template 问题的 ListView 内的 ScrollView
【发布时间】:2020-10-06 04:15:13
【问题描述】:

我正在使用ng-template + ListView 来推送动态内容,例如图片。
ListViewScrollView 内。
我需要滚动整个页面,避免ListView引起的双重滚动。
作为解决方法,我将isUserInteractionEnabled="false" 放在ListView 上以锁定内容并防止滚动,但内容就像“剪切”一样,即使有更多图像要显示,我也无法再滚动。

代码:

<ListView [items]="items" isUserInteractionEnabled="false">
            <ng-template let-item="item">
                <GridLayout columns="auto" rows="*, *">
                    <GridLayout row="0" col="0" columns="auto" rows="*">
                        <Image col="0" row="0" stretch="fill" height="240" width="240" [src]="item.imageSquare.url"></Image>
                    </GridLayout>
                    <GridLayout row="1" col="0" columns="auto" rows="*">
                        <Image col="0" row="0" stretch="fill" height="160" width="540" [src]="item.imageRect.url"></Image>
                    </GridLayout>
                </GridLayout>
            </ng-template>
        </ListView>

【问题讨论】:

  • 我尝试使用GridLayout*ngFor 来创建动态内容,而不是ListView
  • GridLayout 有问题,所以我尝试使用StackLayout 并已部分解决。

标签: android ios layout nativescript


【解决方案1】:

你必须给列表视图一个很高的评价,这样性能才能顺利进行

<ListView height="150" [items]="items">

doc

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-22
    • 1970-01-01
    • 2021-02-18
    • 1970-01-01
    • 2018-06-13
    • 2021-12-18
    相关资源
    最近更新 更多