【问题标题】:Xamarin Forms listview item with label+circle background带有标签+圆形背景的 Xamarin 表单列表视图项
【发布时间】:2016-05-27 21:11:47
【问题描述】:

我想在 Android 和 IOS 的 Xamarin Forms 中设计我的 ListView。

我想做这个项目列表:

我的问题是带数字的圆圈。事实上,我不知道如何在 Xamarin Forms 中制作圆圈。

这是我的 itemTemplate:

<ViewCell.View>
<StackLayout HorizontalOptions="FillAndExpand" Padding="10" BackgroundColor="{Binding RowColor}">
    <Label Text="{Binding Name}" TextColor="White" FontSize="20"
           LineBreakMode="NoWrap" />
    <Grid HorizontalOptions="FillAndExpand">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="4*" />
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        <Label Text="{Binding BarcodeMessage}" Grid.Column="0"
               HorizontalOptions="FillAndExpand" TextColor="White" /> 
        <Label Text="{Binding Quantity}" Grid.Column="1"
               HorizontalOptions="FillAndExpand" TextColor="White" />
    </Grid>
</StackLayout>

你能帮帮我吗?

谢谢

【问题讨论】:

标签: listview label xamarin.forms geometry


【解决方案1】:

使用带有圆圈的标签作为背景图像,然后将文本放入其中。或者,对于网格,您可以使用带有标签(透明背景)的 Image 控件。

还有一个RoundedBoxView 插件可能有用。

【讨论】:

  • 哼!我必须放一张图片,我 Xamarin 没有控件做圆圈?
  • 现在您可以使用 frame 及其cornerradius 属性来实现这一点
猜你喜欢
  • 2014-10-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-07-15
  • 2019-03-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多