如何在 ListView Xamarin Forms 中创建圆形的第一个和最后一个 viewcell?
Posted
技术标签:
【中文标题】如何在 ListView Xamarin Forms 中创建圆形的第一个和最后一个 viewcell?【英文标题】:How to create a rounded first and last viewcell in ListView Xamarin Forms? 【发布时间】:2016-12-04 18:03:44 【问题描述】:我想创建下图中提到的ListView
。问题是我不想创建一个完整的圆形ListView
。我只想要一个矩形ListView
标题和圆形的第一个和最后一个ViewCell
?谁能告诉我该怎么做?
【问题讨论】:
你的目标是什么平台? android 和 ios 使用 Xamarin Forms 【参考方案1】:You can use this type
<ListView x:Name="lstView"
BackgroundColor="White"
HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="0,10,0,15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Grid.Column="1" Source="Binding Image" />
<StackLayout Grid.Column="2" Orientation="Vertical">
<Label Text="Binding Title" TextColor="#f36e22" />
<Label Text="Binding Text" TextColor="Black" />
</StackLayout>
<Image Grid.Column="3" Source="Binding smallImage" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
【讨论】:
请评论您的代码。无法通过您的回答来理解您想要达到的目标。以上是关于如何在 ListView Xamarin Forms 中创建圆形的第一个和最后一个 viewcell?的主要内容,如果未能解决你的问题,请参考以下文章
如何在 Xamarin UWP 上的 ListView 中释放内存?
如何在 Xamarin.Forms 中的 ListView 内绑定列表
如何在 Xamarin 表单中将数组绑定到 ListView
在 Xamarin Forms iOS 中出现 ListView 之前,如何将 ListView 滚动位置设置为底部?