jasonfry.co.uk

Disabling Overscroll in Gingerbread

The overscrolling in Gingerbread isn’t particularly pretty, and as it’s enabled by default it can end up spewing a large orange pile of crap over your otherwise pretty application. But how do you disable it whilst still keeping your app compatible with versions of Android prior to Gingerbread?

Place this class in your code somewhere:

import android.view.View;

public class OverScrollDisabler
{
	public static void disableOverScroll(View view)
	{
		view.setOverScrollMode(View.OVER_SCROLL_NEVER);
	}
}

And then after instantiating your view, place this piece of code in your class:

if(Build.VERSION.SDK_INT >= 9)
{
	OverScrollDisabler.disableOverScroll(myView);
}

I’ll be adding OverScrollDisabler into uk.co.jasonfry.android.tools very soon, so keep and eye on the github repo.

Enjoy!

[edit]It’s been added!