ListView 和多点触控手势

发布于 2024-09-28 08:44:50 字数 486 浏览 0 评论 0原文

首先,我意识到这不遵循任何特定的约定。我只是想知道是否可能。

我想让我的用户能够对 ListView 中的许多项目执行操作。我的 ListView 项目已经包含一个不同的复选框;并且添加另一个复选框不是一个选项(它看起来很难看?)。

我想知道是否可以通过确定两指滑动覆盖哪些项目来以编程方式突出显示多个项目。

这需要满足以下条件:

1) Android 的 ListView 必须能够确定两指滑动和单指滑动之间的差异。 2)我需要能够澄清两指滑动调用的代码。 3)理想情况下,如果我用两根手指滑动,并且手指到达屏幕底部,ListView将开始滚动;这样我就可以继续突出显示最初不在屏幕上的项目。 4) ListView 必须能够突出显示多个选项。

只要我能确定哪些项目是用两根手指传递的,第四号就可能被黑客攻击。我可以拼凑出我自己的“选择”。完成此操作后,我将通过“菜单”按钮提供一些功能来对这些突出显示的项目执行某些操作。

这一切看起来有可能吗?你怎么认为?

Firstly, I realize this doesn't follow any particular convention. I'm just wondering if it is possible.

I'd like to give my users the ability to perform an action on many items in a ListView. My ListView items already contain a checkbox for something different; and adding another checkbox is not an option (it would look ugly?).

I was wondering if it's possible to programmatically highlight multiple items by determining which items were covered by a two-finger swipe.

This would require a few things:

1) Android's ListView would have to be capable of determining the difference between a two-finger swipe and a single-finger swipe.
2) I would need to be able to clarify which code a two-finger swipe invokes.
3) Ideally, if I'm two-finger swiping, and my fingers reach the bottom of the screen, the ListView would begin scrolling; so I could continue to highlight items that are originally off the screen.
4) The ListView would have to be capable of highlighting more than one option.

Number 4 could probably be hacked around so long as I could determine which items were passed over with the two-fingers. I could hack together my own "selection." After doing this, I would provide some functionality via the Menu button to do something to these highlighted items.

Does any of this seem possible? What do you think?

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

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

发布评论

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

评论(1

﹎☆浅夏丿初晴 2024-10-05 08:44:50

#1 和 #2 可以通过位于 ListView 之上的 GestureDetector 进行处理。然而,这可能与#3 背道而驰。 #4 可能不会由标准 Android“选择”状态处理,但您可以手动调整视图(例如,显示以前不可见的图标、更改某些内容的背景颜色)。

#3,不过,确实感觉需要对 ListView 本身进行修改,考虑到 ListView (和 AbsListView),这让我觉得相当不愉快。代码>) 代码。

解决这个问题的一种方法是将您的手势解释为附加手势(新的两指手势不会清除以前的多选,而是向现有多选添加更多内容),使用菜单选项来清除以前的选择。然后,用户可以选择一些、滚动、选择更多一些等等。

话虽如此,我怀疑这不会很容易被发现。您假设人们会了解 RTFM 的手势,并且我们都知道其效果如何。将其作为一种选择很酷,但请确保以这种方式完成的任何事情也可以通过其他一些更常规的方式完成。

#1 and #2 could be handled via GestureDetector, layered atop your ListView. However, that probably runs counter to #3. #4 probably would not be handled by standard Android "selection" state, but you could manually adjust the views (e.g., show a previously invisible icon, change the background color of something).

#3, though, really feels like it would require modifications to ListView itself, and that strikes me as being rather unpleasant, given the ListView (and AbsListView) code.

One way around that would be to interpret your gestures as additive (a new two-finger gesture does not clear the previous multi-select, but adds more to the existing one), using a menu choice to clear the previous selections. Then, the user can select some, scroll, select some more, etc.

All that being said, I suspect that this will not be very discoverable. You're assuming people will find out about the gestures by RTFM, and we both know how well that works. Having this as an option is cool, but make sure that whatever is done this way can also be done by some other more conventional means.

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