Skip to content Skip to sidebar Skip to footer

Is There A Way To Disable Android Listview Animation?

When we drag a ListView to the end or to the top, we can always drag it a little further and it will show a blank background, then when we release it the ListView will bounce back.

Solution 1:

This may work. Create a new class that contains the following.

import android.view.View;

publicclassOverScrollDisabler
{
    publicstaticvoiddisableOverScroll(View view)
    {
        view.setOverScrollMode(View.OVER_SCROLL_NEVER);
    }
}

Then within your code,

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

More details here: http://jasonfry.co.uk/?id=30

Solution 2:

Solution 3:

Solution 4:

For older versions api < 9 consider:

@OverridepublicbooleandispatchTouchEvent(MotionEvent ev)
{
    intaction= ev.getAction();


    if (action == MotionEvent.ACTION_MOVE) {
        ev.setAction(MotionEvent.ACTION_CANCEL);
        super.dispatchTouchEvent(ev);
        returntrue;
    }       

    returnsuper.dispatchTouchEvent(ev);
}

Post a Comment for "Is There A Way To Disable Android Listview Animation?"