2015-02-23 62 views
0

在這個ViewCell的StackLayout內容中,如果我爲第一個標籤放置FontSize =「Large」屬性,它將在標籤2之上呈現。 在整個ViewCell大小時,不會考慮更改的高度。Xamarin.Forms StackLayout + Android上的ListView - 互相之間的佈局

問題在Android上存在,佈局在Windows Phone模擬器上正常工作,或者在沒有使用ListView的情況下使用。

<ListView x:Name="listView" BackgroundColor="Red"> 
    <ListView.ItemTemplate> 
    <DataTemplate> 
     <ViewCell> 
     <StackLayout> 
      <Label Text="LABEL ONE" FontSize="Large" BackgroundColor="Green" /> 
      <Label Text="LABEL TWO" BackgroundColor="Yellow" /> 
     </StackLayout> 
     </ViewCell> 
    </DataTemplate> 
    </ListView.ItemTemplate> 
</ListView> 

我錯過了什麼,或者它是佈局Xamarin.Forms生成的內容中的錯誤?

+0

我從Xamarin得到了確認,它是表單1.4.5中存在的一個錯誤。 – tmouse 2015-02-24 08:06:39

+0

嘗試使用OnPlatform標記 – 2016-08-27 13:45:40

回答

0

試試這個。您忘記了ViewCell.View標記。

<ListView x:Name="listView" BackgroundColor="Red"> 
    <ListView.ItemTemplate> 
    <DataTemplate> 
     <ViewCell> 
     <ViewCell.View> 
     <StackLayout> 
      <Label Text="LABEL ONE" FontSize="Large" BackgroundColor="Green" /> 
      <Label Text="LABEL TWO" BackgroundColor="Yellow" /> 
     </StackLayout> 
     </ViewCell> 
    </DataTemplate> 
    </ListView.ItemTemplate> 
</ListView>