Android的 - 让onTouch优先的onClick [英] android - giving onTouch priority over onClick
问题描述
我有一个活动,允许用户3个不同的视图之间刷卡。每个视图显示的图像的列表。该图像具有的onClick事件调用一个新的活动,使图像全屏显示。 这一切工作然而确定,如果我尝试了3种不同的视图之间进行刷卡,我的手指扫描过的图像就会触发onClick事件,并打开图像全屏。所以,我想知道我怎么可以把onTouch优先(为页/视图交换)?
I have an activity that allows users to swipe between 3 different views. Each view displays a list of images. The images have onClick events that call a new activity and makes the images full screen. This all works ok however if I try to swipe between the 3 different views and my finger swipes over an image it will trigger the onClick event and open the image fullscreen. So I am wondering how can I put priority on onTouch (for the page/view swapping) ?
(将onTouch事件使用一个gestureListener和我使用onFling和鳍状肢的方法。) (onClick的仅仅是一个imageView.setOnClickListener(新OnClickListener())
(the onTouch event uses a gestureListener and i'm using onFling and flipper methods..) (the onClick is simply a imageView.setOnClickListener(new OnClickListener() )
推荐答案
如果您从onFling(...)它要消耗该事件,并停止传播返回true。
If you return true from your onFling(…) it should consume the event and stop propagation.
这篇关于Android的 - 让onTouch优先的onClick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!