I'm implementing an ImageView
that can handle touch events and using it inside a ViewPager
. In my ImageView
s onTouchEvent
and dispatchTouchEvent
for testing I'm always returning true but it's not working correct and ViewPager
is still working when I'm sliding on my ImageView
. What am i doing wrong?
You aren't looking at the full touch chain. ViewPager implements onInterceptTouchEvent, which gets a chance to take touch events away from a child view. Look into requestDisallowInterceptTouchEvent on the ViewPager, and read up on the full touch handling chain at https://developer.android.com/training/gestures/viewgroup.html