【发布时间】:2020-10-06 04:15:13
【问题描述】:
我正在使用ng-template + ListView 来推送动态内容,例如图片。
ListView 在 ScrollView 内。
我需要滚动整个页面,避免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