Nativescript android搜索栏未与列表视图一起显示
android搜索栏和列表视图在使用网格布局和堆栈布局时出现的问题。当列表视图被注释时,搜索栏显示Nativescript android搜索栏未与列表视图一起显示,android,angularjs,nativescript,Android,Angularjs,Nativescript,android搜索栏和列表视图在使用网格布局和堆栈布局时出现的问题。当列表视图被注释时,搜索栏显示 Action Bar Here <ActionBar title="Home" class="action-bar"> <ActionItem (tap)="showModal()" ios.systemIcon="4" ios.position="left" android.systemIcon="ic_menu_ad
Action Bar Here
<ActionBar title="Home" class="action-bar">
<ActionItem (tap)="showModal()"
ios.systemIcon="4" ios.position="left"
android.systemIcon="ic_menu_add" android.position="actionBar"></ActionItem>
</ActionBar>
<StackLayout class="form">
<SearchBar [formControl]="searchControl" class="input"></SearchBar>
</StackLayout>
<ListView [items]="_batches" (itemTap)="onItemTap($event)" class="list-group">
<ng-template let-comment="item" let-i="index" let-odd="odd" let-even="even">
<!-- The item template can only have a single root view container (e.g. GridLayout, StackLayout, etc.)-->
<StackLayout orientation="horizontal" class="list-group-item" ><StackLayout width="200" height="45">
<Label horizontalAlignment="left" [text]="comment.title" textWrap="true" ></Label>
<Label horizontalAlignment="left" [text]="comment.title" textWrap="true"></Label>
</StackLayout>
<StackLayout width="60">
<Button horizontalAlignment="right" class="edit-button" text="" (tap)="EditItem(comment.id)"></Button>
</StackLayout>
<StackLayout horizontalAlignment="right" width="60">
<Button class="delete-button" text="" (tap)="DeleteItem(comment.id)"></Button>
</StackLayout>
</StackLayout>
</ng-template>
</ListView>
</ScrollView>
</GridLayout> </pre>
这里的操作栏
带滚动视图的网格布局
<StackLayout class="form">
<SearchBar [formControl]="searchControl" class="input"></SearchBar>
</StackLayout>
<ListView [items]="_batches" (itemTap)="onItemTap($event)" class="list-group">
<ng-template let-comment="item" let-i="index" let-odd="odd" let-even="even">
<!-- The item template can only have a single root view container (e.g. GridLayout, StackLayout, etc.)-->
<StackLayout orientation="horizontal" class="list-group-item" ><StackLayout width="200" height="45">
<Label horizontalAlignment="left" [text]="comment.title" textWrap="true" ></Label>
<Label horizontalAlignment="left" [text]="comment.title" textWrap="true"></Label>
</StackLayout>
<StackLayout width="60">
<Button horizontalAlignment="right" class="edit-button" text="" (tap)="EditItem(comment.id)"></Button>
</StackLayout>
<StackLayout horizontalAlignment="right" width="60">
<Button class="delete-button" text="" (tap)="DeleteItem(comment.id)"></Button>
</StackLayout>
</StackLayout>
</ng-template>
</ListView>
</ScrollView>
</GridLayout> </pre>
这是您的布局,了解有关使用布局的更多信息,请访问
<StackLayout class="form">
<SearchBar [formControl]="searchControl" class="input"></SearchBar>
</StackLayout>
<ListView [items]="_batches" (itemTap)="onItemTap($event)" class="list-group">
<ng-template let-comment="item" let-i="index" let-odd="odd" let-even="even">
<!-- The item template can only have a single root view container (e.g. GridLayout, StackLayout, etc.)-->
<StackLayout orientation="horizontal" class="list-group-item" ><StackLayout width="200" height="45">
<Label horizontalAlignment="left" [text]="comment.title" textWrap="true" ></Label>
<Label horizontalAlignment="left" [text]="comment.title" textWrap="true"></Label>
</StackLayout>
<StackLayout width="60">
<Button horizontalAlignment="right" class="edit-button" text="" (tap)="EditItem(comment.id)"></Button>
</StackLayout>
<StackLayout horizontalAlignment="right" width="60">
<Button class="delete-button" text="" (tap)="DeleteItem(comment.id)"></Button>
</StackLayout>
</StackLayout>
</ng-template>
</ListView>
</ScrollView>
</GridLayout> </pre>
上面的代码应该在顶部为您提供一个固定的搜索栏,带有一个可滚动的ListView。如果您仍然有问题,请共享一个游乐场示例,以便重现问题。您需要用代码进一步解释您的问题also@KhurshidAnsari我来看看。
<StackLayout class="form">
<SearchBar [formControl]="searchControl" class="input"></SearchBar>
</StackLayout>
<ListView [items]="_batches" (itemTap)="onItemTap($event)" class="list-group">
<ng-template let-comment="item" let-i="index" let-odd="odd" let-even="even">
<!-- The item template can only have a single root view container (e.g. GridLayout, StackLayout, etc.)-->
<StackLayout orientation="horizontal" class="list-group-item" ><StackLayout width="200" height="45">
<Label horizontalAlignment="left" [text]="comment.title" textWrap="true" ></Label>
<Label horizontalAlignment="left" [text]="comment.title" textWrap="true"></Label>
</StackLayout>
<StackLayout width="60">
<Button horizontalAlignment="right" class="edit-button" text="" (tap)="EditItem(comment.id)"></Button>
</StackLayout>
<StackLayout horizontalAlignment="right" width="60">
<Button class="delete-button" text="" (tap)="DeleteItem(comment.id)"></Button>
</StackLayout>
</StackLayout>
</ng-template>
</ListView>
</ScrollView>
</GridLayout> </pre>