2016-08-30 84 views
0

我有一个页面,在顶部显示一个ActionBar,在下面我看到一个SegmentedBar。对于SegmentedBar的第一个选项卡,我显示一个列表。该列表正在渲染,但没有占用剩余空间。这里是我的代码 -本机脚本Listview没有正确显示

<ActionBar title="NS Learning" android:position="right"> 
    <StackLayout orientation="horizontal" horizontalAlignment="stretch"> 
     <Label text="Jahid Shohel" horizontalAlignment="center"></Label> 
    </StackLayout> 
</ActionBar> 
<GridLayout rows="auto, *" columns="*"> 
    <SegmentedBar row="0" #tabs [items]="items" [(ngModel)]="selectedIndex" selectedBackgroundColor="#fac950"></SegmentedBar> 

    <StackLayout row="1" *ngIf="selectedIndex === 0" height="stretch"> 
     <tab1></tab1> 
    </StackLayout> 
    <StackLayout row="1" *ngIf="selectedIndex === 1" width="100%"> 
     <tab2></tab2> 
    </StackLayout> 
    <StackLayout row="1" *ngIf="selectedIndex === 2" width="100%"> 
     <tab3></tab3> 
    </StackLayout> 
</GridLayout> 

而且我<tab1></tab1>码 -

<DockLayout> 
    <ListView [items]="items" dock="top"> 
     <template let-item="item"> 
      <GridLayout columns="auto, *, auto" rows="auto,auto"> 
       <Image row="0" rowSpan="2" col="0" src="res://user" class="post-image"></Image> 
       <Label row="0" col="1" colSpan="2" text="Good morning! Have a nice day"></Label> 
       <Image row="1" col="1" src="res://facebook_thumb" class="social-icon"></Image> 
       <Label row="1" col="2" text="15 August 2016 11:17:26"></Label> 
      </GridLayout> 
     </template> 
    </ListView> 
</DockLayout> 

而呈现的列表是这样的 -

enter image description here

任何想法,我怎么能解决呢?

+0

你可以尝试使用网格布局,而不是DockLayout为您的ListView的容器。 –

+0

@NikolayTsonev:它的工作,谢谢:) –

回答

0

上的ListView应用height属性值为“100%”

<ListView [items]="items" dock="top" height="100%">