Custom view with GestureDetector

I have one custom view, which I am using in two different fragments.
Now I want to add a GestureDetector in on of the two custom views (only one view class).
Is this possible without the other custom view reacting to gesture detection?
So I can only use the gesture detection in one fragment with my custom view.

Maybe someone has an idea. Thank you