如何在页面末尾设置ListView

如何在页面末尾设置ListView,listview,xamarin,xamarin.forms,prism,stacklayout,Listview,Xamarin,Xamarin.forms,Prism,Stacklayout,我已经使用了VerticalOptions=“EndAndExpand”并在结尾处留下了空间,任何人对此都有想法。 我已经尝试了收集视图,这也是我面临的问题 我在您的代码中发现了问题。实际上,ListView占据了整个页面。如果列表项是静态的,则在列表视图中设置HeightRequest=“100”,或者列表项是动态的,请使用bindablellayout <StackLayout x:Name="QuizzesAnsList" BindableLayout.ItemsSource="{

我已经使用了VerticalOptions=“EndAndExpand”并在结尾处留下了空间,任何人对此都有想法。 我已经尝试了收集视图,这也是我面临的问题


我在您的代码中发现了问题。实际上,
ListView
占据了整个页面。如果列表项是静态的,则在
列表视图中设置
HeightRequest=“100”
,或者列表项是动态的,请使用
bindablellayout

<StackLayout x:Name="QuizzesAnsList" BindableLayout.ItemsSource="{Binding QuizzesQuestionAnswersList}"  VerticalOptions="EndAndExpand" HorizontalOptions="FillAndExpand">
            <BindableLayout.ItemTemplate>
                <DataTemplate>
                    <StackLayout VerticalOptions="Fill" Orientation="Horizontal" Spacing="0" Margin="0,5,0,0">
                                    <Frame  VerticalOptions="Fill" BackgroundColor="{Binding BackgroundColor}" BorderColor="{Binding BorderColor}" HasShadow="False"  HorizontalOptions="FillAndExpand"  CornerRadius="2"  Padding="5" >
                                        <StackLayout Orientation="Horizontal" Spacing="0" VerticalOptions="Fill" HorizontalOptions="FillAndExpand" >

                                            <material:MaterialLabel Margin="5" Text="{Binding AnswerText}" HorizontalTextAlignment="Center" FontSize="17" Style="{Binding FontType,Mode=TwoWay}"
                                                                        VerticalTextAlignment="Center" HorizontalOptions="FillAndExpand" TextColor="White" FontAttributes="Bold" />
                                        </StackLayout>

                                    </Frame>

                                    <StackLayout.GestureRecognizers>
                                        <TapGestureRecognizer
                                                            Command="{Binding Path=BindingContext.SelectedQuizeAnswer, Source={x:Reference QuizzesAnsList}}"
                                                            CommandParameter="{Binding .}"/>
                                    </StackLayout.GestureRecognizers>
                                </StackLayout>

                </DataTemplate>
            </BindableLayout.ItemTemplate>
        </StackLayout>


请为我们提供一些问题重要部分的代码示例,我们无法调试看不见的代码是的sure@RicardoDiasMoraisHi我在你的代码中发现了问题。您可以静态或动态列出项目我猜如果StackLayout包装了整个页面内容,您应该添加另一个包含图像和listview的堆栈,然后StackLayout应该在垂直选项上结束,列表和图像也应该如此,还请记住,如果listview上没有足够的项目,当然,你会有那个空间,列表视图不会“扩展”你拥有的项目越多,它是一个可滚动的布局。如果我当时只有两个答案,那么我需要更多的帮助,如何增加框的高度。设置ViewCell内部的堆栈布局
<StackLayout x:Name="QuizzesAnsList" BindableLayout.ItemsSource="{Binding QuizzesQuestionAnswersList}"  VerticalOptions="EndAndExpand" HorizontalOptions="FillAndExpand">
            <BindableLayout.ItemTemplate>
                <DataTemplate>
                    <StackLayout VerticalOptions="Fill" Orientation="Horizontal" Spacing="0" Margin="0,5,0,0">
                                    <Frame  VerticalOptions="Fill" BackgroundColor="{Binding BackgroundColor}" BorderColor="{Binding BorderColor}" HasShadow="False"  HorizontalOptions="FillAndExpand"  CornerRadius="2"  Padding="5" >
                                        <StackLayout Orientation="Horizontal" Spacing="0" VerticalOptions="Fill" HorizontalOptions="FillAndExpand" >

                                            <material:MaterialLabel Margin="5" Text="{Binding AnswerText}" HorizontalTextAlignment="Center" FontSize="17" Style="{Binding FontType,Mode=TwoWay}"
                                                                        VerticalTextAlignment="Center" HorizontalOptions="FillAndExpand" TextColor="White" FontAttributes="Bold" />
                                        </StackLayout>

                                    </Frame>

                                    <StackLayout.GestureRecognizers>
                                        <TapGestureRecognizer
                                                            Command="{Binding Path=BindingContext.SelectedQuizeAnswer, Source={x:Reference QuizzesAnsList}}"
                                                            CommandParameter="{Binding .}"/>
                                    </StackLayout.GestureRecognizers>
                                </StackLayout>

                </DataTemplate>
            </BindableLayout.ItemTemplate>
        </StackLayout>