我在main-page.xml中有这段代码:
<GridLayout rows="auto, *">
<Label text="Title" class="title" row="0" />
<ListView id="listView" items="{{ listItems }}" row="1">
<ListView.itemTemplate>
<StackLayout>
<Button text="{{ name }}" tap="dd" />
</StackLayout>
</ListView.itemTemplate>
</ListView>
</GridLayout>
当我将标题栏滚动到顶部时(停留并且不要移动),是否有办法使其表现正常?
答案 0 :(得分:1)
我找到了一个更清洁的解决方案:https://docs.nativescript.org/cookbook/ui/repeater
<ScrollView>
<StackLayout>
<Label text="Title" class="title" />
<Repeater id="listItems" items="{{ listItems }}">
<Repeater.itemTemplate>
<StackLayout>
<Button text="{{ name }}" tap="loadGuide" />
</StackLayout>
</Repeater.itemTemplate>
</Repeater>
</StackLayout>
答案 1 :(得分:0)
这肯定是将Label放置在GridLayout的一行(设置为auto
)时的预期行为。你想要实现的目标可以完成,但需要额外的实现,例如像这个(No boring ActionBar)第三方Android库。您可以做的是直接在您的应用中使用纯JavaScript / TypeScript实现相同的功能(通过管理ActionBar的大小)或创建使用提到的Android库的custom NativeScript plugin。
NativeScript的众多优点之一是100%的本机iOS和Android API都是可访问的,这意味着在本地iOS或Android应用程序中可以实现的任何内容都可以在{N}中实现。