2016-08-30 67 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%">