我如何通过对点击事件,通过一个看法?看法、事件

2023-09-07 04:47:09 作者:卩s跳跳虎

所以我有3次,一大一在另外两个顶部。处于顶层是透明的。我希望能够注册上身后的大个在顶部的意见 onTouch 事件,而大个什么都不做。

So I have 3 views, one big one on top of the other two. The one on top is transparent. I want to be able to register an onTouch event on the views behind the big one on top, while the big one does nothing.

如何才能做到这一点?

推荐答案

看看使用 onInterceptTouchEvent(的TouchEvent)的ViewGroup 。该文件有pretty的清楚如何才能达到后,你是这里的东西。你可能会希望延长你透明的父(除非它已经是你写一个扩展),并重写此方法做你的出价。

Take a look at using onInterceptTouchEvent(TouchEvent) from ViewGroup. The documentation there is pretty clear on how you can achieve what you are after here. You will likely want to extend your transparent parent (unless it is already an extension that you wrote) and override this method to do your bidding.