如何在android列表视图中实现fling

发布于 2024-09-29 15:55:42 字数 107 浏览 0 评论 0原文

我想在列表中的每个项目的列表视图中实现 onfling (或一些类似的滑动)。如果我滑动该特定项目,它应该在名称旁边显示三个按钮。

有没有什么想法来实现这个。

I would like to implement onfling (or some similar swipe) in listview in each and every item in list. If I swipe that particular item it should display three buttons next to the name.

Is there any idea to implement this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绮烟 2024-10-06 15:55:42

我在手势检测的帮助下实现了这一点:

gestureDetector = new GestureDetector(context, new MyGestureDetector());
gestureListener = new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent event) {
        return gestureDetector.onTouchEvent(event);
    }
};
mList.setOnTouchListener(gestureListener);

I have implemented this with the help of gesture detection:

gestureDetector = new GestureDetector(context, new MyGestureDetector());
gestureListener = new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent event) {
        return gestureDetector.onTouchEvent(event);
    }
};
mList.setOnTouchListener(gestureListener);
半边脸i 2024-10-06 15:55:42

使用 EfficientAdapter 而不是 listview。使用它您可以设置onFling事件并根据您的需要重写它

Use EfficientAdapter rather than listview. Using which you can set theonFling event and override it to your needs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文