在处理滚动型的Android触摸事件 [英] Handle touch events in ScrollView Android
问题描述
我想实现拖拽正拖放功能为Android 2.2。我重写onTouchListener每个我的控制。但我所有的控制都在里面滚动型。当我所有的控件都可见,滚动型,然后DRA-N-下降正常工作。但是,当不是所有的控制都在screnn可见光和滚动出现,我不能使用DRA正下降。所有的事件来滚动型和滚动型只进行它们。 Contols没有得到触摸事件,并作为结果,我不能再拖累我的控制。 是否有人知道如何解决这个问题?我想,这应该滚动视图进行自我触摸事件,但随后应此触摸事件传递给孩子的控制。我该怎么办呢?还是有其他的解决方案? 谢谢你。
I would like to implement drag-n-drop feature for Android 2.2. I override onTouchListener for each my control. But all my controls are inside ScrollView. When all my controls are visible on in ScrollView, then dra-n-drop works fine. But when not all controls are visible on screnn and scrolling appears, I can't use dra-n-drop. All events come to ScrollView and only scrollview proceed them. Contols didn't get touch events and as result, I can't drag my controls. Does anybody know how to resolve this issue? I suppose, that scrollview should proceed self touch event, but then it should transfer this touch event to the children controls. How can I do it? Or any other solutions? Thanks.
推荐答案
使用 mScrollView.requestDisallowInterceptTouchEvent(真);
来避免滚动型处理touchEvents。另外,作为Ridcully指出 onInterceptTouchEvent处理的触摸事件()
。
Use mScrollView.requestDisallowInterceptTouchEvent(true);
to avoid ScrollView to handle touchEvents. Also as Ridcully pointed out handle the touch event in onInterceptTouchEvent()
.
这篇关于在处理滚动型的Android触摸事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!