删除Xamarin.Forms中的分隔符ListView视图单元格
我在使用Xamarin.Forms的项目中有一个删除Xamarin.Forms中的分隔符ListView视图单元格,listview,xamarin.forms,tableviewcell,Listview,Xamarin.forms,Tableviewcell,我在使用Xamarin.Forms的项目中有一个列表视图。Iam使用viewcell显示数据 现在,两个ViewCell之间有一条分隔线。有一种方法可以删除它,使两个ViewCell始终相互接触 我试着使用separatorvisibility=“None”,但没有什么不同 这是我的密码: <ListView x:Name="AList" StyleId="AList" Grid.Row="0"
列表视图
。Iam使用viewcell
显示数据
现在,两个ViewCell之间有一条分隔线。有一种方法可以删除它,使两个ViewCell始终相互接触
我试着使用separatorvisibility=“None”
,但没有什么不同
这是我的密码:
<ListView x:Name="AList"
StyleId="AList"
Grid.Row="0"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height}"
IsVisible="{Binding IsProcessing, Mode=OneWay, Converter={StaticResource booleanNegationConverter}}"
SeparatorVisibility="None">
<ListView.BackgroundColor>
<OnPlatform x:TypeArguments="Color" iOS="Transparent" />
</ListView.BackgroundColor>
<ListView.RowHeight>
<OnPlatform x:TypeArguments="x:Int32" iOS="150" Android="150" WinPhone="170" />
</ListView.RowHeight>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell > .......</ViewCell></ListView>
.......
separatorvisibility=“None”通常为我做
你在所有平台上都看到了吗
您的视图单元格是否包含任何可能导致此问题的内容?试着切换到一个标准的文本单元格,看看你是否得到了分隔符
在ListView中使用SeparatorColor属性
添加
到您的ListView XAML标记Xamarin 4.6.0.847,属性:SeparatorVisibility
<StackLayout VerticalOptions="FillAndExpand" BackgroundColor="White">
<ListView x:Name="ListViewMenu"
HasUnevenRows="False"
SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Grid Padding="10" BackgroundColor="White">
<Label Text="{Binding Title}" FontSize="20"/>
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
您还可以为ListView编写自己的自定义渲染器,如SeparatorLessListView。对于iOS,你可以看看这个:祝你好运:)我也有同样的问题,Separator或Visibility不工作。在多次重建项目后,它最终移除了线路分离器,仅供任何有困难的人参考。可能是虫子吧??
Footer=""
<StackLayout VerticalOptions="FillAndExpand" BackgroundColor="White">
<ListView x:Name="ListViewMenu"
HasUnevenRows="False"
SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Grid Padding="10" BackgroundColor="White">
<Label Text="{Binding Title}" FontSize="20"/>
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>