javascript - Nativescript 水平滚动效果很好,但不适用于项目模板
问题描述
我正在尝试使用动态列表中的项目模板创建一组水平滚动的项目。以下手动代码按预期工作 - 水平滚动的“票证”列表:
<ScrollView orientation="horizontal">
<StackLayout orientation="horizontal" class="scroll-menu">
<StackLayout class="ticket-panel">
<Label text="A ticket" />
</StackLayout>
<StackLayout class="ticket-panel">
<Label text="A ticket" />
</StackLayout>
<StackLayout class="ticket-panel">
<Label text="A ticket" />
</StackLayout>
<StackLayout class="ticket-panel">
<Label text="A ticket" />
</StackLayout>
</StackLayout>
</ScrollView>
但以下没有。它垂直滚动。itemTemplate 在列表中插入的 xml 是否比我使用 itemTemplate 时更多?
<ScrollView orientation="horizontal">
<StackLayout orientation="horizontal" class="scroll-menu">
<ListView items="{{ ticketList }}">
<ListView.itemTemplate>
<StackLayout class="ticket-panel">
<Label text="A ticket" />
</StackLayout>
</ListView.itemTemplate>
</ListView>
</StackLayout>
</ScrollView>
解决方案
推荐阅读
- reactjs - 为什么在 _document.js 中使用 getInitialProps 会导致 Next.js 应用程序崩溃?
- python - 为什么我的代码会输出?(可能逻辑问题)
- istio - 命名空间“istio-system”中没有 Istio pod
- java - JDA - 新用户加入公会时的事件
- python - 使用枚举函数打印列表的单个值
- linux - 可能是什么原因使程序在两个具有很大不同 ipc(每秒仪器)的计算上运行?
- python - 无法根据类别显示帖子(Django)
- kubernetes - 如何在 digitalocean 上的集群中添加负载均衡器
- emgucv - emgu.cv 框架“Microsoft.WindowsDesktop.App”
- c++ - C++ 函子,有什么有效的方法吗?