多视角OnTouch活动视角、OnTouch

由网友(空守一座城)分享简介:我们正在开发我们需要同时捕获从多个视图MotionEvents的应用程序。当我们试图这样做,安卓仅调度事件的第一次接触视图,并同时接触到另一个视图时,它给我们的第一个观点是ACTION_POINTER_DOWN而已,即使指针坐标的边界内外的其他意见 We are developing an application w...

我们正在开发我们需要同时捕获从多个视图MotionEvents的应用程序。当我们试图这样做,安卓仅调度事件的第一次接触视图,并同时接触到另一个视图时,它给我们的第一个观点是ACTION_POINTER_DOWN而已,即使指针坐标的边界内外的其他意见

We are developing an application where we need to capture MotionEvents from multiple views simultaneously. When we try to do so, Android only dispatches events to the first touched view and, when touching another view simultaneously, it gives us an ACTION_POINTER_DOWN on the first view only, even if the pointer coordinates are outside its bounds and inside the other views'.

有什么办法,我们可以得到分派到每一个感动查看事件(在单独的呼叫OnTouch)?

Is there any way we can get events dispatched to every touched view (in separate calls to OnTouch)?

我们认为,从父视图手动拦截触摸事件,然后将它们分发到每个视图可能会奏效,但即使是这样,它不会是不切实际的东西,我们正在努力实现。有没有更简单的方法?

We believe intercepting the touch events from a parent view and then manually dispatching them to each view might work, but even if it does, it would not be practical for what we are trying to achieve. Is there an easier way?

推荐答案

至少的Andr​​oid 3.0增加了对多个视图之间的分裂触摸事件的支持。

At least Android 3.0 adds support for splitting touch events between multiple Views.

拆分触摸事件,默认情况下启用时AndroidManifest <使用-SDK> 定义是安卓的minSdkVersion =11安卓targetSdkVersion =11。为了说明,请参阅android:splitMotionEvents和android:windowEnableSplitTouch

Split touch events is enabled by default when AndroidManifest <uses-sdk> defines either android:minSdkVersion="11" or android:targetSdkVersion="11". For explanation See android:splitMotionEvents and android:windowEnableSplitTouch

阅读全文

相关推荐

最新文章