I want to disable the fling gesture of a scrollview and it does not seem to be working.. I thought it would be as easy as creating a basic class that extends scrollview and @Overriding
the onFling
method. but eclipse is giving me an error to remove the @Override:
any ideas how to disable the fling
public class ScrollViewNoFling extends ScrollView {
/**
* @param context
* @param attrs
* @param defStyle
*/
public ScrollViewNoFling(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public ScrollViewNoFling(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public ScrollViewNoFling(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
return false;
}
}
I solved same problem with Override fling method. If you override fling method on your ScrollViewNoFling class and not call super.fling on this method, you gonna have not-fling-handled scrollView.
@Override
public void fling (int velocityY)
{
/*Scroll view is no longer gonna handle scroll velocity.
* super.fling(velocityY);
*/
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With