ListView 不会一次呈现所有项目
ListView doesn't render all items at once
nativescript-ng 中的 ListView 不会一次呈现其所有项目。
我有一个包含大约 26 个项目的数组,目前只有字符串。
当我使用 tns debug ios
,并在我的 chrome 浏览器中检查时,只有 20 个被渲染并且 ListView 高度设置为 1000。即使添加更多项目也不会更改此值和要渲染的最后一个元素还是第20位的那个
我要在 ListView 的 translateY 上添加动画 属性 并且我需要整个高度才能使动画正常工作。
<GridLayout rows="auto, auto" columns="*">
<MapView height="400" ...></MapView>
<ListView [items]="countries" class="list-group" row="1" col="0">
<StackLayout *ngFor="let item of countries" height="100">
<Label [text]="item"></Label>
</StackLayout >
</ListView>
</GridLayout
this.countries = ["Austria", "Belgium", "Bulgaria", "Croatia", "Cyprus", "Czech Republic",
"Denmark", "Estonia", "Finland", "France", "Germany", "Greece", "Hungary", "Ireland", "Italy",
"Latvia", "Lithuania", "Luxembourg", "Malta", "Netherlands", "Poland", "Portugal", "Romania", "Slovakia",
"Slovenia", "Spain", "Sweden", "United Kingdom"];
预计:
ListView 高度将设置为其子项的所有高度的总和。在这种情况下~2600
实际:
ListView 高度被截断为 1000。
能够在 IOS 上复制它,并且在我将 GridLayout 中的行高从 auto
更改为 *
后,ListView 转到列表末尾。
Auto
根据 space 中的内容生成总数 space,因此我假设在构建页面时并非所有内容都已加载,因此即使所有项目在那里,ListView
的高度被限制了。
<GridLayout rows="auto, *" columns="*">
...
</GridLayout>
nativescript-ng 中的 ListView 不会一次呈现其所有项目。
我有一个包含大约 26 个项目的数组,目前只有字符串。
当我使用 tns debug ios
,并在我的 chrome 浏览器中检查时,只有 20 个被渲染并且 ListView 高度设置为 1000。即使添加更多项目也不会更改此值和要渲染的最后一个元素还是第20位的那个
我要在 ListView 的 translateY 上添加动画 属性 并且我需要整个高度才能使动画正常工作。
<GridLayout rows="auto, auto" columns="*">
<MapView height="400" ...></MapView>
<ListView [items]="countries" class="list-group" row="1" col="0">
<StackLayout *ngFor="let item of countries" height="100">
<Label [text]="item"></Label>
</StackLayout >
</ListView>
</GridLayout
this.countries = ["Austria", "Belgium", "Bulgaria", "Croatia", "Cyprus", "Czech Republic",
"Denmark", "Estonia", "Finland", "France", "Germany", "Greece", "Hungary", "Ireland", "Italy",
"Latvia", "Lithuania", "Luxembourg", "Malta", "Netherlands", "Poland", "Portugal", "Romania", "Slovakia",
"Slovenia", "Spain", "Sweden", "United Kingdom"];
预计: ListView 高度将设置为其子项的所有高度的总和。在这种情况下~2600
实际: ListView 高度被截断为 1000。
能够在 IOS 上复制它,并且在我将 GridLayout 中的行高从 auto
更改为 *
后,ListView 转到列表末尾。
Auto
根据 space 中的内容生成总数 space,因此我假设在构建页面时并非所有内容都已加载,因此即使所有项目在那里,ListView
的高度被限制了。
<GridLayout rows="auto, *" columns="*">
...
</GridLayout>