Xamarin Forms Listview in Scrollview doesn't scroll

白昼怎懂夜的黑 提交于 2019-12-30 23:49:13

问题


<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
         x:Class="Dh.ListPage">
<ContentPage.Content>
    <ScrollView>
        <StackLayout Style="{StaticResource MainStackLayoutWhenLoggedInStyle}">
            <Frame Style="{StaticResource FrameStyle2}">
                <StackLayout>
                    <Label Text="Vragenlijsten" Style="{StaticResource TitelLabelStyle}" />
                </StackLayout>
            </Frame>
            <Frame Style="{StaticResource FrameStyle2}">
                <StackLayout>
                    <Label Text="DRINGENDE VRAGEN: vul deze vragen meteen in!" Style="{StaticResource StandardLabelStyle}"/>
                    <Frame Style="{StaticResource FrameStyle2}">
                        <StackLayout Style="{StaticResource ListViewStackLayoutStyle}" >
                            <ListView ItemTapped="OnItemTapped" ItemsSource="{Binding Question_Lists}" Style="{StaticResource StandardListViewStyle}">
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <ViewCell>
                                            <ViewCell.View>
                                                <Label Text="{Binding Title}" Style="{StaticResource StandardLabelStyle}" />
                                            </ViewCell.View>
                                        </ViewCell>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                            </ListView>
                        </StackLayout>
                    </Frame>
                </StackLayout>
            </Frame>
        </StackLayout>
    </ScrollView>
</ContentPage.Content>

When my screen is too small then my listview does not want to scroll. If my screen is not too small then listview does scroll. Can someone help me pls?


回答1:


Never stack a ListView inside a ScrollView as both implement scrolling on Android at least.




回答2:


Xamarin.Forms.ScrollView Class documentation says:

Application developers should not nest one ScrollView within another. Additionally, they should refrain from nesting them other elements that can scroll, such as WebView.

ListView.ScrollTo Method Scrolls the ListView to the item.



来源:https://stackoverflow.com/questions/37111016/xamarin-forms-listview-in-scrollview-doesnt-scroll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!