gpt4 book ai didi

android - Android listview打开手势的实现方法

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:18:35 28 4
gpt4 key购买 nike

这是一个关于 Android ListViews、Gestures 和 Animations 的悬而未决的问题。我真的不熟悉 Android 中的手势,所以我只是在寻找想法和灰质。

这是两个截图和a video影响我正在思考的事情的例子。考虑看一下视频,这真的很值得。

enter image description here

enter image description here

截图来自发现的一个iOS开源项目here .

问题是,您将如何实现“ ListView 打开”手势,就像我在 iPhone/iPad 应用程序中越来越频繁地看到的那样,但对于 Android 而言?

编辑 1,想法 1:

好吧,第一个想法,据我所知,捏合手势有点像拖动手势,所以我想我们可以获得屏幕上两个手指的 X 和 Y 坐标?

接下来,the answer to this question可能有帮助,基本思想是:

Get the index position of the first visible item in the list

Get the index position of the last visible item in the list

Iterate from the first index to the last with the getChildAt function

For each child, call the getLocationOnScreen method to get coordinates of the current iterated item

之后,可能会在循环内完成捏合手势坐标和每个项目坐标之间的一些比较,以获得必须在其间插入新行的两个项目。

性能方面的考虑我认为它可以工作,但也许有更简单的方法来获得这两个项目(?)。

下一个是谁? :)

更新:

感谢@rhlnair 的提示,我借此机会告诉大家我开始在业余时间从事这项工作,欢迎您为此提供帮助。

项目在https://github.com/arnaudbos/Android-GestureListView .我在两个不同的分支上开始了两个不同的实现,并希望任何人都能创建一个新分支。

我在分支“attemp-via-scale-gesture-detector”中有一些非常令人鼓舞的东西,但 ListView 有一些副作用。

来吧伙计们!

最佳答案

似乎是一个具有挑战性的想法..

我认为 clear app 中的一些效果可以从

https://github.com/commonsguy/cwac-touchlist

关于android - Android listview打开手势的实现方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9309245/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com