【发布时间】:2015-11-10 21:52:18
【问题描述】:
我的ListViews 在他们的孩子之前和之后都添加了大量的填充。
例如,我的主人中有以下ListView
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewModel="clr-namespace:ViewModel;assembly=App"
x:Class="Pages.Master"
Title="Menu">
<ContentPage.BindingContext>
<viewModel:MasterViewModel />
</ContentPage.BindingContext>
<ListView ItemsSource="{Binding Pages}"
ItemSelected="ListView_OnItemSelected"
BackgroundColor="Red">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label Text="S" BackgroundColor="White" />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage>
它呈现以下内容:
只要滚动一点,它就会显示第一个元素(即顶部的红色空间等于高度)
同样你可以一直滚动直到最后一项完全消失(即底部红色空间等于高度)
我不会在代码中更改任何视图的属性/样式 - 都是在 XAML 中完成的,那么为什么前后会有这么大的空间?
【问题讨论】:
标签: xamarin xamarin.android xamarin.forms