Skip to content

Instantly share code, notes, and snippets.

@kneeman
Created March 4, 2016 00:08
Show Gist options
  • Save kneeman/e8bfef9f85440e47e9f8 to your computer and use it in GitHub Desktop.
Save kneeman/e8bfef9f85440e47e9f8 to your computer and use it in GitHub Desktop.
private boolean isViewVisible(View view) {
Rect scrollBounds = new Rect();
mScrollView.getDrawingRect(scrollBounds);
float top = view.getY();
float bottom = top + view.getHeight();
if (scrollBounds.top < top && scrollBounds.bottom > bottom) {
return true;
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment