有什么方法可以在radlistview项目上程序化地执行滑动操作吗?

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

我使用的是nativescript & angular,我有一个RadListView,可以通过点击来执行滑动操作。向左滑动显示一个删除按钮,向右滑动显示一个 "选项 "按钮。

当项目加载完毕后,我想 程式化向右滑动 第一个项目的视图。我知道我可以用getViewItemAt(O)来获取第一个项目的视图,但我不知道这是否可行,也不知道如何应用程序化的滑动手势来实现。

android nativescript swipe radlistview
1个回答
0
投票

更新

如果还有人在寻找这个问题,可以通过简单的动画项目视图来实现。

... items loaded ... then 
{
    let item = this.radList.listView.getItemAtIndex(0);
    let view = this.radList.listView.getViewForItem(item);
    setTimeout(()=> {
        //animate on x axis - will show the swipe action at the right 
        view.animate({
            translate: { x: 80, y: 0},
            duration: 50,
            curve: AnimationCurve.spring
        });
        //animate back to hide it
        setTimeout(()=> {
            view.animate({
                translate: { x: 0, y: 0},
                duration: 50,
                curve: AnimationCurve.spring
            });
        }, 1000);

    }, 2000);  
}
...
© www.soinside.com 2019 - 2024. All rights reserved.