【发布时间】:2017-04-05 00:30:42
【问题描述】:
我想知道如何使项目分开,而不是彼此非常接近。现在,每个项目在 iOS 上都太接近了。 我尝试在 ListView 和 StackLayout 上设置 Margin 和 Space,但每个项目之间的空间没有改变。为了增加空间,我发现我需要对图像单元做一些事情。图像单元格继承自文本单元格,但没有设置边距或空格的属性。有谁知道这个技巧吗?
public MasterPageCS ()
{
var masterPageItems = new List<MasterPageItem> ();
masterPageItems.Add (new MasterPageItem {
Title = "Contacts",
IconSource = "contacts.png",
TargetType = typeof(ContactsPageCS)
});
masterPageItems.Add (new MasterPageItem {
Title = "TodoList",
IconSource = "todo.png",
TargetType = typeof(TodoListPageCS)
});
masterPageItems.Add (new MasterPageItem {
Title = "Reminders",
IconSource = "reminders.png",
TargetType = typeof(ReminderPageCS)
});
listView = new ListView {
ItemsSource = masterPageItems,
ItemTemplate = new DataTemplate (() => {
var imageCell = new ImageCell (); //This one!!!!
imageCell.SetBinding (TextCell.TextProperty, "Title");
imageCell.SetBinding (ImageCell.ImageSourceProperty, "IconSource");
return imageCell;
}),
VerticalOptions = LayoutOptions.FillAndExpand,
SeparatorVisibility = SeparatorVisibility.None
};
Padding = new Thickness (0, 40, 0, 0);
Icon = "hamburger.png";
Title = "Personal Organiser";
Content = new StackLayout {
VerticalOptions = LayoutOptions.FillAndExpand,
Children = {
listView
}
};
}
【问题讨论】:
标签: xamarin.forms