首页 > 解决方案 > 如何从 IOS 的列表视图中删除分隔线?

问题描述

我在删除每个列表项后的分隔线时遇到问题,并且无法更改分隔线颜色。

我在 Listview 标记和 CSS 中尝试了 separatorColor="transparent" 属性,但它们都不起作用。我也尝试过 SeparatorVisibility="None" 属性,但没有运气。

我已经尝试过GitHub 提供的这个解决方案,但它不起作用。

这是代码:

<GridLayout row="1" class="shop-list-container">
    <ListView [items]="rewardsPageData?.shops" class="list-group"  height="{{rewardsPageData?.shops?.length * 75}}" separatorColor="transparent">
        <ng-template let-shop="item">
            <GridLayout class="shop-item list-group-item" columns="2*, 6*, 2*" rows="*, auto" (tap)="goToShopDetails(shop.id)">
                <Image src="{{shop.logoImageUrl}}" class="thumb img-circle" col="0" row="0" rowSpan="2" horizontalAlignment="left"></Image>
                <Label class="shop-name" [text]="shop.title" row="0" col="1"></Label>
                <Label class="shop-type" text="{{shop?.category}}" row="1" col="1"></Label>
                <Label text="See location" class="see-location-text" textWrap="true" col="2" row="0" rowSpan="2" horizontalAlignment="right"></Label>
            </GridLayout>
        </ng-template>
    </ListView>
</GridLayout>

标签: nativescriptnativescript-angular

解决方案


我创建了一个孤立的示例,在 CSS 中将分隔符颜色设置为透明,并且在 iOS 中对我来说效果很好。注意 app.css 中的 ListView 规则。

如果您删除 CSS 规则并将其设置separatorColor="transparent"为 home.component.html 中的 ListView 对象,它同样有效。


推荐阅读