gpt4 book ai didi

ios - 插入多个 RadListView 在 iOS 上不显示

转载 作者:行者123 更新时间:2023-11-29 05:52:46 26 4
gpt4 key购买 nike

我需要在同一页面上有多个 RadListView,我正在使用 NativeScript Angular

我不知道每个列表中的项目数,并且项目的大小可能会非常不同,具体取决于项目包含的文本量。

可以这么说,我需要三个彼此重叠的 RadList - 第一个可能有 3 个项目,接下来的 72 个项目和最后的 9 个项目。我希望每个列表都采用其内容所需的高度,这样我就可以将它们显示在彼此之上,无论它们有多长。

在 Android 上,它的工作方式就像一个魅力 - 每个 radlistview 都占据显示其项目所需的高度,并在之后立即生成下一个 radlistview

另一方面,在 iOS 上,情况非常不同 - 如果我不设置 RadListView 本身的高度,它就不会显示。

我有两个 RadListViews 位于 GridLayout 中,并为行提供绝对值,如 row="150, 150"甚至 rows="*,*"将显示所提供值允许的尽可能多的列表 -但我需要它是 rows="auto, auto"因为我不知道每个列表有多高,而且我想显示所有项目。

直接在 RadListView 上设置高度也可以,但同样 - 我不知道高度。

直接在 RadListView 上设置 height="100%"并不能解决我的问题,因为我无法拥有绝对的父高度。

这是否可能,或者我是否必须计算高度属性的数字(我真的不想这样做)

再次强调...该问题仅存在于 iOS 设备上。

我尝试将 dataItem 作为 ObservableArray 和对象类型的普通数组提供:name[],因为我认为 ObservableArray 的异步性可能会发挥作用,但这并不重要 - 我什至可以使用常量(如代替 )填充文本属性。不过,如果行或 RadListView 本身没有设置高度,则不会显示任何内容。

问候

<GridLayout rows="auto, auto'>
<RadListView [items]=" dataItems">
<ng-template tkListItemTemplate let-item="item">
<StackLayout orientation="vertical">
<Label [text]="item.firstname"></Label>
<Label [text]="item.lastname"></Label>
</StackLayout>
</ng-template>
</RadListView>
<RadListView [items]="dataItems">
<ng-template tkListItemTemplate let-item="item">
<StackLayout orientation="vertical">
<Label [text]="item.firstname"></Label>
<Label [text]="item.lastname"></Label>
</StackLayout>
</ng-template>
</RadListView>
</GridLayout>

最佳答案

我为你创建了一个 Playground here 。当您使用GridLayout时,您需要将row分配给RadListView。

<GridLayout rows="auto, auto'>
<RadListView row="0" [items]=" dataItems">
<ng-template tkListItemTemplate let-item="item">
<StackLayout orientation="vertical">
<Label [text]="item.firstname"></Label>
<Label [text]="item.lastname"></Label>
</StackLayout>
</ng-template>
</RadListView>
<RadListView row="1" [items]="dataItems">
<ng-template tkListItemTemplate let-item="item">
<StackLayout orientation="vertical">
<Label [text]="item.firstname"></Label>
<Label [text]="item.lastname"></Label>
</StackLayout>
</ng-template>
</RadListView>
</GridLayout>

关于ios - 插入多个 RadListView 在 iOS 上不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55525999/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com