You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class OwnScroller extends Scroller {
private int durationScrollMs;
private final int MS = 1000;
public OScroller(Context context, int secondScrollDuration) {
super(context);
this.durationScrollMs = secondScrollDuration * MS;
}
@Override
public void startScroll(int startX, int startY, int dx, int dy, int duration) {
super.startScroll(startX, startY, dx, dy, this.durationScrollMs);
}
}
Try to create a custom scroller class and override the startScroll function with your own duration.
LoopingViewPager loopingViewPager = findViewById(R.id.viewpager);
private final int durationSec = 5;
try{
Class<?> viewPager = ViewPager.class;
Field scroller = viewPager.getDeclaredField("mScroller");
scroller.setAccessible(true);
scroller.set(loopingViewPager,new OwnScroller(context,durationSec));
}catch (Exception e){
e.printStackTrace();
}
Try to call with reflection and set your custom scroll class.
How to set slide speed?
is there any method to set slide speed?
The text was updated successfully, but these errors were encountered: