我正在尝试学习 NativeScript,发现了 2 个独立的项目并尝试将它们组合起来,但是当我这样做时,滚动不起作用,你能解释一下为什么或者我做错了什么吗?
这是我的代码
<ActionBar title="myApp" class="action-bar">
</ActionBar>
<GridLayout class="page" orientation="vertical">
<ListView [items]="items" class="list-group">
<ng-template let-item="item">
<Label [nsRouterLink]="['/item', item.id]" [text]="item.name"
class="list-group-item"></Label>
</ng-template>
</ListView>
</GridLayout>
<TabView #tabview [selectedIndex]="tabindex" class="tab-view"
selectedColor="#4099FF" >
<StackLayout align="top" *tabItem="{title:'Home',iconSource:'res://home'}">
<home-tab></home-tab>
</StackLayout>
<StackLayout *tabItem="{title: 'Explore', iconSource:'res://explore'}">
<Label class="border" borderWidth="5" borderColor="black" text="hey">
</Label>
</StackLayout>
<StackLayout *tabItem="{title: 'Notifications',
iconSource:'res://notifications'}">
</StackLayout>
</TabView>
在顶部我有选项卡,下面有项目列表,但无法向下滚动,它不起作用
最佳答案
使用<ScrollView> </ScrollView>
围绕您要滚动的内容。 https://docs.nativescript.org/angular/code-samples/ui/scroll-view
关于Nativescript 滚动不适用于 stackLayout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47601923/