Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在主活动中,有一个父视图和一个子视图。
我需要同时在两个视图中获取运动事件。有可能这样做吗?
目前,我只能在子视图中拦截运动事件。父视图什么也没收到。
主要任务是两者可以同时获取运动事件。请帮忙。
谢谢。
您可以根据要执行的操作使用这些方法:
http://developer.android.com/reference/android/view/ViewGroup.html#onInterceptTouchEvent(android.view.MotionEvent )
http://developer.android.com/reference/android/view/View.html#dispatchTouchEvent(android.view.MotionEvent )