Skip to content

Instantly share code, notes, and snippets.

@philipesteiff
Last active August 29, 2015 13:57
Show Gist options
  • Save philipesteiff/9641729 to your computer and use it in GitHub Desktop.
Save philipesteiff/9641729 to your computer and use it in GitHub Desktop.
Custom ViewPager para Viewpagers aninhados
public class FocusLooserViewPager extends ViewPager {
public FocusLooserViewPager(Context context) {
super(context);
}
public FocusLooserViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
/**
* Previne que os filhos percam seu precioso swipe
*/
@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
if (v != this && v instanceof ViewPager) {
return true;
}
return super.canScroll(v, checkV, dx, x, y);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment