Xamarin.forms listview中的ScrollView工作不正常
我把一个滚动视图放在一个列表视图中,它不能正常工作;它有时会卡住。我更改了VerticalOptions属性,但它会滚动移动,然后卡住 这是我的标记:Xamarin.forms listview中的ScrollView工作不正常,xamarin.forms,Xamarin.forms,我把一个滚动视图放在一个列表视图中,它不能正常工作;它有时会卡住。我更改了VerticalOptions属性,但它会滚动移动,然后卡住 这是我的标记: <ListView RowHeight="70" ItemTapped="ListView_ItemTapped" Margin="15,10" HasUnevenRows="True" SeparatorVisibility="None" ItemsSource="{Binding InteractionsHistory}"> &
<ListView RowHeight="70" ItemTapped="ListView_ItemTapped" Margin="15,10" HasUnevenRows="True" SeparatorVisibility="None" ItemsSource="{Binding InteractionsHistory}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell >
<StackLayout BackgroundColor="White"
Orientation="Horizontal"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Margin="0,0,0,10">
<Grid HorizontalOptions="FillAndExpand" RowSpacing="1" Margin="0,5,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="1" />
<RowDefinition Height="100"/>
<RowDefinition Height="1" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<StackLayout Grid.Row="0" Orientation="Horizontal" Margin="5,0,5,0" >
<local:ImageCircle Aspect="AspectFill" VerticalOptions="Center" Source="{Binding ChannelImg}" WidthRequest="25" HeightRequest="25"/>
<Label Text="{Binding InteractionAddedBy}" Style="{StaticResource lblCommonVewCase}" HorizontalOptions="FillAndExpand"/>
<Label Text="{Binding CreatedDate}" HorizontalOptions="EndAndExpand" Style="{StaticResource lblCommonVewCase}"/>
</StackLayout>
<StackLayout Margin="5,0,5,0" Style="{StaticResource CommonStackLayout}" Grid.Row="1"></StackLayout>
<ScrollView Margin="10,10,10,0" Grid.Row="2" VerticalOptions="Fill" Orientation="Vertical" HorizontalOptions="Fill" BackgroundColor="AliceBlue" >
<Label Text="{Binding InteractionDesc}" VerticalOptions="FillAndExpand" Style="{StaticResource lblCommonVewCase}"/>
</ScrollView>
<StackLayout Margin="5,0,5,0" IsVisible="{Binding IsAttachmentVisible}" Style="{StaticResource CommonStackLayout}" Grid.Row="3"></StackLayout>
<StackLayout Grid.Row="4" VerticalOptions="Center" Orientation="Horizontal" Margin="15,0" Padding="0,5"
IsVisible="{Binding IsAttachmentVisible}" BackgroundColor="White">
<Image Source="attach.png" HeightRequest="15" WidthRequest="15" VerticalOptions="Center"/>
<Label Text="Attachments" Style="{StaticResource lblCommonVewCase}" VerticalOptions="Center"/>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="ViewAttach_Tapped" CommandParameter="{Binding .}"></TapGestureRecognizer>
</StackLayout.GestureRecognizers>
</StackLayout>
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
您不应该将ListView放在ScrollView中,因为ListView类实现了自己的滚动,并且不接收手势,因为它们都由父ScrollView处理
即使在本机平台开发中,也不鼓励这样做。在ListView中使用ScrollView或其他方式是非常不鼓励的,因为这样会导致奇怪的行为,如下面所示。我建议你另找一种方法来解决你的问题。好的,谢谢你宝贵的时间,先生