NativeScript RadListView用页脚滚动到底部

问题描述 投票:0回答:1

我正在使用RadListView,并试图以编程方式滚动到列表的底部。我可以使用scrollToIndex()功能滚动到列表中的最后一个元素,但是我的列表具有页脚,因此也需要滚动到该位置。除了滚动到最后一个元素然后用页脚的高度执行scrollWithAmount()之外,我无法找到一种干净的方法。这种方法无法发挥最大的作用,我觉得应该有更好的方法。

[Here是显示问题的游乐场。

nativescript angular2-nativescript nativescript-angular nativescript-telerik-ui radlistview
1个回答
0
投票

要滚动到RadListView的最底部,您可以简单地计算其高度并按数量滚动。

    let to;
    if (this.radList.ios) {
        const collectionView = this.radList.nativeViewProtected.collectionView;
        to = Math.max(0, collectionView.contentSize.height - collectionView.bounds.size.height);
    } else {
        to = layout.toDevicePixels(this.radList.getMeasuredHeight());
    }
    this.radList.scrollWithAmount(to, false);

Updated Playground

© www.soinside.com 2019 - 2024. All rights reserved.