在xamarin表单中的空间之间的Listview项目

时间:2017-10-30 11:51:36

标签: xamarin xamarin.forms

这是我的listview类

public class ListViewClass : ListView
{        
    public ListViewClass ()
    {    
        var cell = new DataTemplate(typeof(ViewCellClass));                
        ItemTemplate = cell;
        SeparatorVisibility = SeparatorVisibility.None;
        this.Style = (Style)Application.Current.Resources["commonBottomMarginThickness"];
        HasUnevenRows = true;                    
    }            
}

我附上了截图。如何在上面和下面的列表视图项之间放置空格。

enter image description here

1 个答案:

答案 0 :(得分:1)

将值Transparent添加到SeparatorColor属性。

像这样:

public ListViewClass ()
{    
    var cell = new DataTemplate(typeof(ViewCellClass));                
    ItemTemplate = cell;
    SeparatorVisibility = SeparatorVisibility.None;
    SeparatorColor = Color.Transparent;
    this.Style = (Style)Application.Current.Resources["commonBottomMarginThickness"];
    HasUnevenRows = true;                    
}