There are certain doubts, but still, all of a sudden, this behavior is possible.
The bottom line: I have a FrameLayout ( from here ) with an onTouch event for zuming. There are several elements in this Frame that accept onClick and onLongClick events:

for (int i = 0; i < locations.size(); i++) { locations.get(i).getView().setOnClickListener(onPoleClick); locations.get(i).getView().setOnLongClickListener(onPoleLongClick); } 

if I put a listener on click - MyFrame.onTouch ceases to function and the field is not zooming. If I tidy up - accordingly, I sit without clicks, but with a magnifying field. If I put return false; in MyFrame.onTouch, it also stops working.
I tried to replace locations.get (i) .onClick with onTouch (MotionEvent.UP) - if return true click to Frame does not reach, if return false MotionEvent.UP does not work. MotionEvent.DOWN will not allow to process onLongClick ...

Fife and jug, in general. Maybe there is some way for onTouch to work “through” the clicks?

    2 answers 2

    You can try this:

     public class ZoomFrameLayout extends FrameLayout { public ZoomFrameLayout(Context context) { super(context); } public ZoomFrameLayout(Context context, AttributeSet attrs) { super(context, attrs); } public ZoomFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { boolean upper = super.onInterceptTouchEvent(ev); if (!upper) { // Детектим жесты здесь стандартным детектором // и если зум - отрабатываем и выставляем return true } return upper; } } 

    Those. the ZoomFrameLayout view will take only the zoom, and the clicks will go to the kids.

    And by the way with this use of ScaleDetector all events will be intercepted (there return true at the end). You can try something like if (scaleDetector.isInProgress()) return true;

    • something fails to implement this idea ... I can not understand what it means to "detect by a standard detector and if the zoom ..."? :) all onTouch to transfer there? - Jarvis_J
    • Yes, exactly, great, it all worked! ) only now, when you take a long field of tax in the zoom - onLongClick works, and if not for long, then all is normal) - Jarvis_J
    • Just woke up ;-) To defeat longclick, you probably have to return true to drag too ... - Shutko Alexander
    • yes, I have already figured out how to fix it :) thanks :) - Jarvis_J

    Simply combine both actions in onTouch :

     private int min=50; private int x, dx; public boolean onTouch(View v, MotionEvent event) { if(event.getAction()==MotionEvent.ACTION_DOWN) { x = event.getX(); } else if(event.getAction()==MotionEvent.ACTION_UP) { dx = event.getX(); if (Math.abs( dx - x ) > min) { // зум } else { // клик } } } 
    • I tried it - it starts to work incorrectly onLongClick: - / - Jarvis_J