Billabong
Billabong

Reputation: 467

Pass specific TouchEvent to specific view

I have 2 onTouchListeners() :

 child.setOnTouchListener(new OnTouchListener() {           
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if(event.getAction() == MotionEvent.ACTION_DOWN) {
                    // DO STUFF
                    return true;
                }else if (event.getAction() == MotionEvent.ACTION_UP) {
                    // DO STUFF
                    return true;
                }else if(event.getAction() == MotionEvent.ACTION_MOVE){
                   //pass this event to parent
                }
                    return false;
                }
            }
        });

and my parent onTouchListener() is just the normal implementation. I want to pass the Move-event to the parent's onTouchListener(). Is this possible?

Upvotes: 0

Views: 180

Answers (1)

RaviVadera
RaviVadera

Reputation: 411

Whenever you want to pass the touch event to the parent, just return false from that code path. For your requirement, return false if the action is ACTION_MOVE.

Upvotes: 1

Related Questions