[英]How to make a Listview overlap a stacklayout in Xamarin Forms?
[英]How to create a listview with custom StackLayout size Xamarin Forms
我正在嘗試使用圖像和標簽創建ListView,但是問題是,我無法與StackLayout一起調整圖像的大小。 那是我的XAML代碼:
<ListView x:Name="listView">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout BackgroundColor="#eee"
Orientation="Vertical">
<StackLayout Orientation="Vertical">
<Image Source="{Binding image}" />
<Label Text="{Binding title}"
TextColor="#f35e20" />
<Label Text="{Binding subtitle}"
HorizontalOptions="StartAndExpand"
TextColor="#503026" />
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
我嘗試添加Image HeightRequest
和WidthRequest
的道具,並且圖像確實發生了變化,但是StackLayout
沒有變化
從我的意見,設置ListView.HasUnevenRows = true
,這樣的ListView
不會限制您單元的大小,然后你需要讓UI知道,電池的大小通過運行改變ViewCell.ForceUpdateSize()
的實例ViewCell
,進行了其Image
調整大小。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.