If you think the Android project Coloring-book listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.kidsgames.menu;
/*www.java2s.com*/import android.content.Context;
import android.view.animation.Interpolator;
import android.widget.Scroller;
publicclass FixedSpeedScroller extends Scroller {
privateint mDuration = 1;
privatedouble mScrollFactor = 10;
public FixedSpeedScroller(Context context, Interpolator interpolator) {
super(context, interpolator);
}
@Override
publicvoid startScroll(int startX, int startY, int dx, int dy) {
// Ignore received duration, use fixed one instead
super.startScroll(startX, startY, dx, dy, mDuration);
}
publicvoid setScrollDurationFactor(double scrollFactor) {
mScrollFactor = scrollFactor;
}
@Override
publicvoid startScroll(int startX, int startY, int dx, int dy,
int duration) {
int newDur = duration;
int scrollFactor = 2;
if (duration == 200) {
newDur = 200;
scrollFactor = 5;
}
super.startScroll(startX, startY, dx, dy,
(int) (newDur * scrollFactor));
}
}