问题描述
我使用 Xamarin.Forms 为 android 和 ios 创建了一个应用程序。在 android 上一切正常,但我对 ios 有一点问题。我的应用程序包含一个由两个不同选项卡组成的 TabbedPage。每个选项卡都是一个内容页面,其中有一个列表视图。这是代码:
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="MyApp.Views">
<TabbedPage.Children>
<ContentPage x:Name="page1">
<ContentPage.toolbaritems>
<ToolbarItem Icon="more.png" Clicked="ToolbarItem_Clicked"/>
</ContentPage.toolbaritems>
<ListView ItemsSource="{Binding JobsTodo}"
x:Name="listView"
VerticalScrollBarVisibility="Always"
RowHeight="240"
SeparatorColor="Transparent"
BackgroundColor="#fffffd"
SelectionMode="None" ItemTemplate="{StaticResource startJob}" />
</ContentPage>
<ContentPage x:Name="page2">
<ListView
ItemsSource="{Binding JobsEnded}"
VerticalScrollBarVisibility="Always"
RowHeight="240"
SeparatorColor="#4b4b4b"
BackgroundColor="#fffffd"
SelectionMode="None" ItemTemplate="{StaticResource endJob}" />
</ContentPage>
</TabbedPage.Children>
问题是“page2”中的第二个 ListView 被冻结,我无法滚动它。 “page1”中的 ListView 工作正常。我注意到,当您在具有 2 个或更多选项卡的 IOS 上使用 TabbedPage 并且其中一个选项卡包含 ListView 时,ListView 也会被冻结。这是一个错误还是我做错了什么?请帮帮我
解决方法
我找到了解决问题的方法。我已将 XF 从 4.7 更新到最新版本,现在在两个平台上一切正常。