So, I know this question is pretty old, but I've come with a solution which I think has some extra advantages over the one posted here. One situation that could happen is that I could have more than one HorizontalScrollView inside my ViewPager (which I do), and then I would need to provide tons of Ids to the ViewPager so it can always check for child touch conflicts.
I analyzed the source from the ViewPager, and found that they use this method called "canScroll" to determine if a child view can be scrolled. Luckily, it wasn't made static nor final, so I could just override it. Inside that method that the "boolean ViewCompat.canScrollHorizontally(View, int)" was called (the one that always returns false for SDK < 14). My solution then was:
public class CustomViewPager extends ViewPager {
public CustomViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomViewPager(Context context) {
super(context);
}
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
return super.canScroll(v, checkV, dx, x, y) || (checkV && customCanScroll(v));
}
protected boolean customCanScroll(View v) {
if (v instanceof HorizontalScrollView) {
View hsvChild = ((HorizontalScrollView) v).getChildAt(0);
if (hsvChild.getWidth() > v.getWidth())
return true;
}
return false;
}
}
So, if you have a different class of View inside your ViewPager that should also receive horizontal drags, just change the customCanScroll(View) so you can return if the touch should not be intercepted or not.
The boolean checkV is true if the current view should also be checked for 'scrollability', that's why we should also check for that.
Hope this helps future issues like this (or if there is a better solution, or an official one from the Android platform, let me know).