【问题标题】:Remove Seperator ListView View cells Xamarin.Forms删除分隔符 ListView 查看单元格 Xamarin.Forms
【发布时间】:2020-06-16 00:16:18
【问题描述】:

我在使用 Xamarin.Forms 的项目中有一个 ListView。我使用ViewCells来显示数据。

现在,两个 ViewCell 之间显示了一条分隔线。有一种方法可以删除它,以便两个 ViewCell 始终相互接触。

我尝试使用SeperatorVisibility="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>

【问题讨论】:

标签: listview xamarin.forms tableviewcell


【解决方案1】:

SeperatorVisibility="None" 通常是为我做的。

您是否在所有平台上都看到了这一点?

您的视图单元格是否包含可能导致它的任何内容?尝试切换到标准 TextCell 并查看是否有分隔符。

【讨论】:

  • 我也遇到了相同的问题,即 SeperatorVisibility 不起作用。在多次重建项目后,它终于删除了行分隔符,仅供任何挣扎的人参考。可能有错误??
  • 您的正确答案有误:它是:SeparatorVisibility="None"
【解决方案2】:

在 ListView 中使用 SeparatorColor 属性

<ListView SeparatorColor="Transparent">
</ListView>

【讨论】:

    【解决方案3】:

    添加

    Footer=""
    

    到您的 ListView XAML 标记

    【讨论】:

      【解决方案4】:

      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>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-06-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多