Skip to content

Instantly share code, notes, and snippets.

@ksc91u
Created August 15, 2014 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksc91u/df81b97110cb0eef7758 to your computer and use it in GitHub Desktop.
Save ksc91u/df81b97110cb0eef7758 to your computer and use it in GitHub Desktop.
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
int itemsPerView = getLastVisiblePosition() - getFirstVisiblePosition() + 1;
if ((getAdapter().getCount() / itemsPerView) > 3) {
setFastScrollEnabled(true);
setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET);
}else{
setFastScrollEnabled(false);
setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment