6

I need to totally disable overscroll in my listviews so I can implement my own overscroll functionality.

Seems to be simple enough when looking at the core listview classes, just by setting the overscroll mode to OVERSCROLL_NEVER. This fine work on my Samsung Galaxy s2. But doesn't work For Galaxy Tab 2.3.3.

Has anyone had much experience with samsung ListView customizations that can help me?

Parag Chauhan
  • 35,760
  • 13
  • 86
  • 95

1 Answers1

3

It worked for me on Samsung Galaxy Tab (with Android 2.2):

try {

    // list you want to disable overscroll
    // replace 'R.id.services' with your list id
    ListView listView = ((ListView)findViewById(R.id.services)); 

    // find the method
    Method setEnableExcessScroll =
            listView.getClass().getMethod("setEnableExcessScroll", Boolean.TYPE);

    // call the method with parameter set to false 
    setEnableExcessScroll.invoke(listView, Boolean.valueOf(false)); 

}
catch (SecurityException e) {}
catch (NoSuchMethodException e) {}
catch (IllegalArgumentException e) {}
catch (IllegalAccessException e) {}
catch (InvocationTargetException e) {}
TheVoid
  • 89
  • 2
  • Brilliant!!! This really saved me a lot of hassle. How did you know what method name to look up, is the S2 API public? – npace May 17 '13 at 11:45