public class CalendarEventView extends LinearLayout {
public CalendarEventView(Context context) {
super(context);
}
public CalendarEventView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CalendarEventView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);
if((event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_UP) && event.getAction() != MotionEvent.ACTION_MOVE){
Log.v("move", "click");
return true;
}
return false;
}
}
I have 2 viewpagers which I synchronise. One contains CalendarEventViews. They were staying synchronised until I added onClick and onLongClick to my CalendarEventView (I set these listeners in the viewpager).
My problem is that I can only get either clicks working or scroll working, but not both. In other words how do I let my CalendarEventView consume clicks but let its parent handle movement/scrolling.
Note: I don't mind if both the CalendarEventView and the parent (viewpager) are able to handle the event as long as they both receive it.