[英]ListView.HasUnevenRows property is not working in Xamarin.Forms.iOS
如果我设置“ListView.hasUnevenRows = True”,那么列表视图的行高应该基于它的项目内容。 这适用于 Android 和 iOS(几乎适用于所有设备)。
但是在 iPhone 12 (14.5) 中,此属性不起作用,这意味着未根据项目内容设置行高。
有没有人遇到过这种情况? 我应该在 Xamarin 官方论坛上问这个问题,但在此之前我只想确认是否有任何解决方法,或者我在这里遗漏了什么
我在我这边做了一个测试,它工作正常,如下所示:
小:
<ListView x:Name="mylist" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Label Text="{Binding Name}"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
代码隐藏:
public TestPage1()
{
InitializeComponent();
List<People> peoples = new List<People> {
new People {Name="111111111111111111111111111111111111111111111111111222" ,age=10},
new People{Name="333333333333" ,age=20},
new People{ Name="hahahahahaha" ,age=30}
};
mylist.ItemsSource = peoples;
}
这是您可以测试的示例链接: https : //github.com/xamarin/xamarin-forms-samples/tree/main/WorkingWithListview/WorkingWithListview/Uneven
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.