Android ViewFlipper +手势检测器
我正在使用手势检测器来捕获“flings”,并在发生这种情况时使用视图翻转器来更改屏幕。我的一些子视图包含列表视图。如果您在列表视图上滑动,手势检测器将无法识别滑动。但如果它位于 TextView 或 ImageView 的顶部,它会识别它。有没有办法实现它,以便它能够识别滑动,即使它们位于另一个具有 ClickListener 的视图之上?
I am using gesture detector to catch "flings" and using a view flipper to change the screen when this happens. Some of my child views contain list views. The the gesture detector wont recognize a swipe if you swipe on the list view. But it will recognize it if it is onTop of TextView's or ImageView's. Is there a way to implement it so that it will recognize the swipes even if they are on top of another view that has a ClickListener?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
android-journey.blogspot 还有另一个很棒的解决方案
There is another wonderful solution at android-journey.blogspot
谢谢您的回答。为了让它按照我想要的方式工作,我必须添加以下内容:
myList.setOnTouchListener(gestureListener);
对于我的每个列表。现在,它们可以正确识别水平滑动以更改视图,以及垂直移动以滚动列表。
Thank you for your answer. In order to get it working how I wanted it to all I had to add was this:
myList.setOnTouchListener(gestureListener);
for each of my lists. Now they correctly recognize horizontal swipes to change views, and vertical movement for scrolling the list.
此处的示例: http://android-developers .blogspot.com/2009/10/gestures-on-android-16.html
我使用本教程来查看 Android 的手势叠加视图。它来自的示例有一个 ListView,利用此 GestureOverlayView 来滚动列表。
An example from here: http://android-developers.blogspot.com/2009/10/gestures-on-android-16.html
I used this tutorial to look at Android's gesture overlay view. The example which this comes from has a ListView utilizing this GestureOverlayView to scroll the list.