0

我正在使用 nativescript 和 angular,并且我有一个带有点击执行滑动操作的 RadListView。向左滑动显示删除按钮,向右滑动显示“选项”按钮。

加载项目后,我想以编程方式向右滑动第一个项目。我知道我可以使用 getViewItemAt(O) 查看第一个项目,但我不知道这是否可能或如何对其应用程序化滑动手势

4

1 回答 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);  
}
...

于 2020-04-26T15:20:10.593 回答