在点击 Nativescript Angular + LineSeparator Color 时删除 ListView 项目突出显示?

Remove ListView item highlight on tap Nativescript Angular + LineSeparator Color?

现在是 2020 年 12 月,人们仍然难以消除由此引起的 ListViewLineSeparator 上的突出显示效果。 我正在使用 Angular + Nativescript.

这是删除点按突出显示的 iOS 解决方法,它有效:

onItemLoading(args: ItemEventData) {
    if (isIOS) {
        var cell = args.ios;
        cell.selectionStyle = UITableViewCellSelectionStyle.UITableViewCellSelectionStyleNone;
    }
  }

Android 问题:如何用 Android 做到这一点?
Android & iOS 问题:如何从 ListView 中删除 SeparatorLine 颜色?

这是我的 tns-info:

Getting NativeScript components versions information...
⚠ Update available for component nativescript. Your current version is 6.8.0 and the latest available version is 7.0.12.
✔ Component tns-core-modules has 6.6.0-next-2020-05-08-112112-01 version and is up to date.
✔ Component tns-android has 6.5.3 version and is up to date.
⚠ Update available for component tns-ios. Your current version is 6.5.2 and the latest available version is 6.5.3.

非常感谢大家。

要删除 android 上的 highlight/ripple,您可以挂接到 Listviewloaded 事件并设置一些 android 属性,如下所示:

<ListView (loaded)="onLoaded($event)"></ListView>
declare const android;

onLoaded(event) {
  if (event.object.android) {
    event.object.android.setSelector(new android.graphics.drawable.StateListDrawable());
  }
}

对于分隔符颜色,您应该可以直接在 html 中或通过 css:

使用 separatorColor 属性
<ListView separatorColor="transparent"></ListView>
ListView {
  separator-color: transparent;
}