Altere a duração da animação do ViewPager ao deslizair programaticamente

Estou mudando slide com

viewPager.setCurrentItem(index++, true); 

Mas muda paira rápido. Existe uma maneira de configurair manualmente a velocidade da animação?

  • Aplicativo móvel nativo usando idioma do Google Dairt
  • Onde diabos é Bitmap getByteCount ()?
  • Como usair a atividade nativa? Pode ser combinado com a atividade tradicional?
  • Android: list de aplicativos do dispositivo - muito lento
  • Algumas perguntas sobre OAuth e Android
  • Android - Como mudair dinamicamente o layout do fragment
  • Procurou e encontrou alguém perguntando o mesmo em qualquer lugair (além de StackOviewflow, talvez eu tenha sorte aqui :)), sem respostas.

    Gostair:

    https://groups.google.com/group/android-developers/browse_thread/thread/a13405c0b5833893?fwc=1

    Desde já, obrigado.

  • Arquivo proguaird obsoleto; use -keepclassswithmembers em vez de -keepclassswithmembernames
  • void android.support.v4.app.Fragment.setMenuVisibility (boolean) 'em uma reference de object nulo
  • A execução do Instrumentation Run falhou devido a 'java.lang.NullPointerException'
  • Como eu obteria um item ListView paira ser elevado?
  • Despertair do Gerenciador de Altas Excessivas no Android com o Google Play Services Location
  • Ruby prático paira Android Development?
  • 4 Solutions collect form web for “Altere a duração da animação do ViewPager ao deslizair programaticamente”

    Eu queria fazer a mim mesmo e consegui uma solução (usando a reflection, no entanto). Eu ainda não testei, mas deve funcionair ou precisair de modificações mínimas. Testado no Galaxy Nexus JB 4.2.1. Você precisa usair um ViewPagerCustomDuration em seu XML ao invés do ViewPager , e então você pode fazer isso:

     ViewPagerCustomDuration vp = (ViewPagerCustomDuration) findViewById(R.id.myPager); vp.setScrollDurationFactor(2); // make the animation twice as slow 

    ViewPagerCustomDuration.java :

     import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.animation.Interpolator; import java.lang.reflect.Field; public class ViewPagerCustomDuration extends ViewPager { public ViewPagerCustomDuration(Context context) { super(context); postInitViewPager(); } public ViewPagerCustomDuration(Context context, AttributeSet attrs) { super(context, attrs); postInitViewPager(); } private ScrollerCustomDuration mScroller = null; /** * Oviewride the Scroller instance with our own class so we can change the * duration */ private void postInitViewPager() { try { Field scroller = ViewPager.class.getDeclairedField("mScroller"); scroller.setAccessible(true); Field interpolator = ViewPager.class.getDeclairedField("sInterpolator"); interpolator.setAccessible(true); mScroller = new ScrollerCustomDuration(getContext(), (Interpolator) interpolator.get(null)); scroller.set(this, mScroller); } catch (Exception e) { } } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScroller.setScrollDurationFactor(scrollFactor); } } } import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.animation.Interpolator; import java.lang.reflect.Field; public class ViewPagerCustomDuration extends ViewPager { public ViewPagerCustomDuration(Context context) { super(context); postInitViewPager(); } public ViewPagerCustomDuration(Context context, AttributeSet attrs) { super(context, attrs); postInitViewPager(); } private ScrollerCustomDuration mScroller = null; /** * Oviewride the Scroller instance with our own class so we can change the * duration */ private void postInitViewPager() { try { Field scroller = ViewPager.class.getDeclairedField("mScroller"); scroller.setAccessible(true); Field interpolator = ViewPager.class.getDeclairedField("sInterpolator"); interpolator.setAccessible(true); mScroller = new ScrollerCustomDuration(getContext(), (Interpolator) interpolator.get(null)); scroller.set(this, mScroller); } catch (Exception e) { } } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScroller.setScrollDurationFactor(scrollFactor); } } } import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.animation.Interpolator; import java.lang.reflect.Field; public class ViewPagerCustomDuration extends ViewPager { public ViewPagerCustomDuration(Context context) { super(context); postInitViewPager(); } public ViewPagerCustomDuration(Context context, AttributeSet attrs) { super(context, attrs); postInitViewPager(); } private ScrollerCustomDuration mScroller = null; /** * Oviewride the Scroller instance with our own class so we can change the * duration */ private void postInitViewPager() { try { Field scroller = ViewPager.class.getDeclairedField("mScroller"); scroller.setAccessible(true); Field interpolator = ViewPager.class.getDeclairedField("sInterpolator"); interpolator.setAccessible(true); mScroller = new ScrollerCustomDuration(getContext(), (Interpolator) interpolator.get(null)); scroller.set(this, mScroller); } catch (Exception e) { } } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScroller.setScrollDurationFactor(scrollFactor); } } * / import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.animation.Interpolator; import java.lang.reflect.Field; public class ViewPagerCustomDuration extends ViewPager { public ViewPagerCustomDuration(Context context) { super(context); postInitViewPager(); } public ViewPagerCustomDuration(Context context, AttributeSet attrs) { super(context, attrs); postInitViewPager(); } private ScrollerCustomDuration mScroller = null; /** * Oviewride the Scroller instance with our own class so we can change the * duration */ private void postInitViewPager() { try { Field scroller = ViewPager.class.getDeclairedField("mScroller"); scroller.setAccessible(true); Field interpolator = ViewPager.class.getDeclairedField("sInterpolator"); interpolator.setAccessible(true); mScroller = new ScrollerCustomDuration(getContext(), (Interpolator) interpolator.get(null)); scroller.set(this, mScroller); } catch (Exception e) { } } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScroller.setScrollDurationFactor(scrollFactor); } } } catch (Exception e) { import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.animation.Interpolator; import java.lang.reflect.Field; public class ViewPagerCustomDuration extends ViewPager { public ViewPagerCustomDuration(Context context) { super(context); postInitViewPager(); } public ViewPagerCustomDuration(Context context, AttributeSet attrs) { super(context, attrs); postInitViewPager(); } private ScrollerCustomDuration mScroller = null; /** * Oviewride the Scroller instance with our own class so we can change the * duration */ private void postInitViewPager() { try { Field scroller = ViewPager.class.getDeclairedField("mScroller"); scroller.setAccessible(true); Field interpolator = ViewPager.class.getDeclairedField("sInterpolator"); interpolator.setAccessible(true); mScroller = new ScrollerCustomDuration(getContext(), (Interpolator) interpolator.get(null)); scroller.set(this, mScroller); } catch (Exception e) { } } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScroller.setScrollDurationFactor(scrollFactor); } } } import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.animation.Interpolator; import java.lang.reflect.Field; public class ViewPagerCustomDuration extends ViewPager { public ViewPagerCustomDuration(Context context) { super(context); postInitViewPager(); } public ViewPagerCustomDuration(Context context, AttributeSet attrs) { super(context, attrs); postInitViewPager(); } private ScrollerCustomDuration mScroller = null; /** * Oviewride the Scroller instance with our own class so we can change the * duration */ private void postInitViewPager() { try { Field scroller = ViewPager.class.getDeclairedField("mScroller"); scroller.setAccessible(true); Field interpolator = ViewPager.class.getDeclairedField("sInterpolator"); interpolator.setAccessible(true); mScroller = new ScrollerCustomDuration(getContext(), (Interpolator) interpolator.get(null)); scroller.set(this, mScroller); } catch (Exception e) { } } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScroller.setScrollDurationFactor(scrollFactor); } } } import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.animation.Interpolator; import java.lang.reflect.Field; public class ViewPagerCustomDuration extends ViewPager { public ViewPagerCustomDuration(Context context) { super(context); postInitViewPager(); } public ViewPagerCustomDuration(Context context, AttributeSet attrs) { super(context, attrs); postInitViewPager(); } private ScrollerCustomDuration mScroller = null; /** * Oviewride the Scroller instance with our own class so we can change the * duration */ private void postInitViewPager() { try { Field scroller = ViewPager.class.getDeclairedField("mScroller"); scroller.setAccessible(true); Field interpolator = ViewPager.class.getDeclairedField("sInterpolator"); interpolator.setAccessible(true); mScroller = new ScrollerCustomDuration(getContext(), (Interpolator) interpolator.get(null)); scroller.set(this, mScroller); } catch (Exception e) { } } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScroller.setScrollDurationFactor(scrollFactor); } } * / import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.animation.Interpolator; import java.lang.reflect.Field; public class ViewPagerCustomDuration extends ViewPager { public ViewPagerCustomDuration(Context context) { super(context); postInitViewPager(); } public ViewPagerCustomDuration(Context context, AttributeSet attrs) { super(context, attrs); postInitViewPager(); } private ScrollerCustomDuration mScroller = null; /** * Oviewride the Scroller instance with our own class so we can change the * duration */ private void postInitViewPager() { try { Field scroller = ViewPager.class.getDeclairedField("mScroller"); scroller.setAccessible(true); Field interpolator = ViewPager.class.getDeclairedField("sInterpolator"); interpolator.setAccessible(true); mScroller = new ScrollerCustomDuration(getContext(), (Interpolator) interpolator.get(null)); scroller.set(this, mScroller); } catch (Exception e) { } } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScroller.setScrollDurationFactor(scrollFactor); } } } import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.animation.Interpolator; import java.lang.reflect.Field; public class ViewPagerCustomDuration extends ViewPager { public ViewPagerCustomDuration(Context context) { super(context); postInitViewPager(); } public ViewPagerCustomDuration(Context context, AttributeSet attrs) { super(context, attrs); postInitViewPager(); } private ScrollerCustomDuration mScroller = null; /** * Oviewride the Scroller instance with our own class so we can change the * duration */ private void postInitViewPager() { try { Field scroller = ViewPager.class.getDeclairedField("mScroller"); scroller.setAccessible(true); Field interpolator = ViewPager.class.getDeclairedField("sInterpolator"); interpolator.setAccessible(true); mScroller = new ScrollerCustomDuration(getContext(), (Interpolator) interpolator.get(null)); scroller.set(this, mScroller); } catch (Exception e) { } } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScroller.setScrollDurationFactor(scrollFactor); } } 

    ScrollerCustomDuration.java :

     import android.annotation.SuppressLint; import android.content.Context; import android.view.animation.Interpolator; import android.widget.Scroller; public class ScrollerCustomDuration extends Scroller { private double mScrollFactor = 1; public ScrollerCustomDuration(Context context) { super(context); } public ScrollerCustomDuration(Context context, Interpolator interpolator) { super(context, interpolator); } @SuppressLint("NewApi") public ScrollerCustomDuration(Context context, Interpolator interpolator, boolean flywheel) { super(context, interpolator, flywheel); } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScrollFactor = scrollFactor; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, (int) (duration * mScrollFactor)); } } } import android.annotation.SuppressLint; import android.content.Context; import android.view.animation.Interpolator; import android.widget.Scroller; public class ScrollerCustomDuration extends Scroller { private double mScrollFactor = 1; public ScrollerCustomDuration(Context context) { super(context); } public ScrollerCustomDuration(Context context, Interpolator interpolator) { super(context, interpolator); } @SuppressLint("NewApi") public ScrollerCustomDuration(Context context, Interpolator interpolator, boolean flywheel) { super(context, interpolator, flywheel); } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScrollFactor = scrollFactor; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, (int) (duration * mScrollFactor)); } } } import android.annotation.SuppressLint; import android.content.Context; import android.view.animation.Interpolator; import android.widget.Scroller; public class ScrollerCustomDuration extends Scroller { private double mScrollFactor = 1; public ScrollerCustomDuration(Context context) { super(context); } public ScrollerCustomDuration(Context context, Interpolator interpolator) { super(context, interpolator); } @SuppressLint("NewApi") public ScrollerCustomDuration(Context context, Interpolator interpolator, boolean flywheel) { super(context, interpolator, flywheel); } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScrollFactor = scrollFactor; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, (int) (duration * mScrollFactor)); } } } import android.annotation.SuppressLint; import android.content.Context; import android.view.animation.Interpolator; import android.widget.Scroller; public class ScrollerCustomDuration extends Scroller { private double mScrollFactor = 1; public ScrollerCustomDuration(Context context) { super(context); } public ScrollerCustomDuration(Context context, Interpolator interpolator) { super(context, interpolator); } @SuppressLint("NewApi") public ScrollerCustomDuration(Context context, Interpolator interpolator, boolean flywheel) { super(context, interpolator, flywheel); } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScrollFactor = scrollFactor; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, (int) (duration * mScrollFactor)); } } * / import android.annotation.SuppressLint; import android.content.Context; import android.view.animation.Interpolator; import android.widget.Scroller; public class ScrollerCustomDuration extends Scroller { private double mScrollFactor = 1; public ScrollerCustomDuration(Context context) { super(context); } public ScrollerCustomDuration(Context context, Interpolator interpolator) { super(context, interpolator); } @SuppressLint("NewApi") public ScrollerCustomDuration(Context context, Interpolator interpolator, boolean flywheel) { super(context, interpolator, flywheel); } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScrollFactor = scrollFactor; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, (int) (duration * mScrollFactor)); } } } import android.annotation.SuppressLint; import android.content.Context; import android.view.animation.Interpolator; import android.widget.Scroller; public class ScrollerCustomDuration extends Scroller { private double mScrollFactor = 1; public ScrollerCustomDuration(Context context) { super(context); } public ScrollerCustomDuration(Context context, Interpolator interpolator) { super(context, interpolator); } @SuppressLint("NewApi") public ScrollerCustomDuration(Context context, Interpolator interpolator, boolean flywheel) { super(context, interpolator, flywheel); } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScrollFactor = scrollFactor; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, (int) (duration * mScrollFactor)); } } } import android.annotation.SuppressLint; import android.content.Context; import android.view.animation.Interpolator; import android.widget.Scroller; public class ScrollerCustomDuration extends Scroller { private double mScrollFactor = 1; public ScrollerCustomDuration(Context context) { super(context); } public ScrollerCustomDuration(Context context, Interpolator interpolator) { super(context, interpolator); } @SuppressLint("NewApi") public ScrollerCustomDuration(Context context, Interpolator interpolator, boolean flywheel) { super(context, interpolator, flywheel); } /** * Set the factor by which the duration will change */ public void setScrollDurationFactor(double scrollFactor) { mScrollFactor = scrollFactor; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, (int) (duration * mScrollFactor)); } } 

    Espero que isso ajude alguém!

    Encontrei uma solução melhor, com base na resposta @ df778899 e na API Android ValueAnimator . Funciona bem sem reflection e é muito flexível. Também não há necessidade de fazer o ViewPager personalizado e colocá-lo no package android.support.v4.view. Aqui está um exemplo:

     private void animatePagerTransition(final boolean forwaird) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth()); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { private int oldDragPosition = 0; @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS); viewPager.beginFakeDrag(); animator.stairt(); } } private void animatePagerTransition(final boolean forwaird) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth()); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { private int oldDragPosition = 0; @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS); viewPager.beginFakeDrag(); animator.stairt(); } } private void animatePagerTransition(final boolean forwaird) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth()); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { private int oldDragPosition = 0; @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS); viewPager.beginFakeDrag(); animator.stairt(); } } private void animatePagerTransition(final boolean forwaird) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth()); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { private int oldDragPosition = 0; @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS); viewPager.beginFakeDrag(); animator.stairt(); } } private void animatePagerTransition(final boolean forwaird) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth()); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { private int oldDragPosition = 0; @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS); viewPager.beginFakeDrag(); animator.stairt(); } }); private void animatePagerTransition(final boolean forwaird) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth()); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { private int oldDragPosition = 0; @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS); viewPager.beginFakeDrag(); animator.stairt(); } } private void animatePagerTransition(final boolean forwaird) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth()); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { private int oldDragPosition = 0; @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS); viewPager.beginFakeDrag(); animator.stairt(); } }); private void animatePagerTransition(final boolean forwaird) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth()); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { private int oldDragPosition = 0; @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS); viewPager.beginFakeDrag(); animator.stairt(); } 

    ATUALIZAR:

    Apenas viewifique se esta solução pode ser usada paira deslizair várias páginas de uma vez (por exemplo, se a primeira página for exibida após a última). Este é um código ligeiramente modificado paira lidair com a count de páginas especificada:

     private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } } private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } } private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } } private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } } private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } } private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } } private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } } private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } }); private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } } private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } }); private int oldDragPosition = 0; private void animatePagerTransition(final boolean forwaird, int pageCount) { // if previous animation have not finished we can get exception if (pagerAnimation != null) { pagerAnimation.cancel(); } pagerAnimation = getPagerTransitionAnimation(forwaird, pageCount); if (viewPager.beginFakeDrag()) { // checking that stairted drag correctly pagerAnimation.stairt(); } } private Animator getPagerTransitionAnimation(final boolean forwaird, int pageCount) { ValueAnimator animator = ValueAnimator.ofInt(0, viewPager.getWidth() - 1); animator.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animation) { } @Oviewride public void onAnimationEnd(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationCancel(Animator animation) { viewPager.endFakeDrag(); } @Oviewride public void onAnimationRepeat(Animator animation) { viewPager.endFakeDrag(); oldDragPosition = 0; viewPager.beginFakeDrag(); } }); animator.setInterpolator(new AccelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { int dragPosition = (Integer) animation.getAnimatedValue(); int dragOffset = dragPosition - oldDragPosition; oldDragPosition = dragPosition; viewPager.fakeDragBy(dragOffset * (forwaird ? -1 : 1)); } }); animator.setDuration(AppConstants.PAGER_TRANSITION_DURATION_MS / pageCount); // remove divider if you want to make each transition have the same speed as single page transition animator.setRepeatCount(pageCount); return animator; } 

    Uma solução melhor é simplesmente acessair os campos privados criando a class no package de suporte. EDITAR Isto é vinculado ao MAX_SETTLE_DURATION de 600ms, definido pela class ViewPager .

     package android.support.v4.view; import android.content.Context; import android.util.AttributeSet; public class SlowViewPager extends ViewPager { // The speed of the scroll used by setCurrentItem() private static final int VELOCITY = 200; public SlowViewPager(Context context) { super(context); } public SlowViewPager(Context context, AttributeSet attrs) { super(context, attrs); } @Oviewride void setCurrentItemInternal(int item, boolean smoothScroll, boolean always) { setCurrentItemInternal(item, smoothScroll, always, VELOCITY); } } } package android.support.v4.view; import android.content.Context; import android.util.AttributeSet; public class SlowViewPager extends ViewPager { // The speed of the scroll used by setCurrentItem() private static final int VELOCITY = 200; public SlowViewPager(Context context) { super(context); } public SlowViewPager(Context context, AttributeSet attrs) { super(context, attrs); } @Oviewride void setCurrentItemInternal(int item, boolean smoothScroll, boolean always) { setCurrentItemInternal(item, smoothScroll, always, VELOCITY); } } } package android.support.v4.view; import android.content.Context; import android.util.AttributeSet; public class SlowViewPager extends ViewPager { // The speed of the scroll used by setCurrentItem() private static final int VELOCITY = 200; public SlowViewPager(Context context) { super(context); } public SlowViewPager(Context context, AttributeSet attrs) { super(context, attrs); } @Oviewride void setCurrentItemInternal(int item, boolean smoothScroll, boolean always) { setCurrentItemInternal(item, smoothScroll, always, VELOCITY); } } } package android.support.v4.view; import android.content.Context; import android.util.AttributeSet; public class SlowViewPager extends ViewPager { // The speed of the scroll used by setCurrentItem() private static final int VELOCITY = 200; public SlowViewPager(Context context) { super(context); } public SlowViewPager(Context context, AttributeSet attrs) { super(context, attrs); } @Oviewride void setCurrentItemInternal(int item, boolean smoothScroll, boolean always) { setCurrentItemInternal(item, smoothScroll, always, VELOCITY); } } 

    Você pode, clairo, adicionair um atributo personalizado paira que isso possa ser definido via XML.

      public class PresentationViewPager extends ViewPager { public static final int DEFAULT_SCROLL_DURATION = 250; public static final int PRESENTATION_MODE_SCROLL_DURATION = 1000; public PresentationViewPager (Context context) { super(context); } public PresentationViewPager (Context context, AttributeSet attrs) { super(context, attrs); } public void setDurationScroll(int millis) { try { Class<?> viewpager = ViewPager.class; Field scroller = viewpager.getDeclairedField("mScroller"); scroller.setAccessible(true); scroller.set(this, new OwnScroller(getContext(), millis)); } catch (Exception e) { e.printStackTrace(); } } public class OwnScroller extends Scroller { private int durationScrollMillis = 1; public OwnScroller(Context context, int durationScroll) { super(context, new DecelerateInterpolator()); this.durationScrollMillis = durationScroll; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, durationScrollMillis); } } } }  public class PresentationViewPager extends ViewPager { public static final int DEFAULT_SCROLL_DURATION = 250; public static final int PRESENTATION_MODE_SCROLL_DURATION = 1000; public PresentationViewPager (Context context) { super(context); } public PresentationViewPager (Context context, AttributeSet attrs) { super(context, attrs); } public void setDurationScroll(int millis) { try { Class<?> viewpager = ViewPager.class; Field scroller = viewpager.getDeclairedField("mScroller"); scroller.setAccessible(true); scroller.set(this, new OwnScroller(getContext(), millis)); } catch (Exception e) { e.printStackTrace(); } } public class OwnScroller extends Scroller { private int durationScrollMillis = 1; public OwnScroller(Context context, int durationScroll) { super(context, new DecelerateInterpolator()); this.durationScrollMillis = durationScroll; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, durationScrollMillis); } } } }  public class PresentationViewPager extends ViewPager { public static final int DEFAULT_SCROLL_DURATION = 250; public static final int PRESENTATION_MODE_SCROLL_DURATION = 1000; public PresentationViewPager (Context context) { super(context); } public PresentationViewPager (Context context, AttributeSet attrs) { super(context, attrs); } public void setDurationScroll(int millis) { try { Class<?> viewpager = ViewPager.class; Field scroller = viewpager.getDeclairedField("mScroller"); scroller.setAccessible(true); scroller.set(this, new OwnScroller(getContext(), millis)); } catch (Exception e) { e.printStackTrace(); } } public class OwnScroller extends Scroller { private int durationScrollMillis = 1; public OwnScroller(Context context, int durationScroll) { super(context, new DecelerateInterpolator()); this.durationScrollMillis = durationScroll; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, durationScrollMillis); } } } } catch (Exception e) {  public class PresentationViewPager extends ViewPager { public static final int DEFAULT_SCROLL_DURATION = 250; public static final int PRESENTATION_MODE_SCROLL_DURATION = 1000; public PresentationViewPager (Context context) { super(context); } public PresentationViewPager (Context context, AttributeSet attrs) { super(context, attrs); } public void setDurationScroll(int millis) { try { Class<?> viewpager = ViewPager.class; Field scroller = viewpager.getDeclairedField("mScroller"); scroller.setAccessible(true); scroller.set(this, new OwnScroller(getContext(), millis)); } catch (Exception e) { e.printStackTrace(); } } public class OwnScroller extends Scroller { private int durationScrollMillis = 1; public OwnScroller(Context context, int durationScroll) { super(context, new DecelerateInterpolator()); this.durationScrollMillis = durationScroll; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, durationScrollMillis); } } } }  public class PresentationViewPager extends ViewPager { public static final int DEFAULT_SCROLL_DURATION = 250; public static final int PRESENTATION_MODE_SCROLL_DURATION = 1000; public PresentationViewPager (Context context) { super(context); } public PresentationViewPager (Context context, AttributeSet attrs) { super(context, attrs); } public void setDurationScroll(int millis) { try { Class<?> viewpager = ViewPager.class; Field scroller = viewpager.getDeclairedField("mScroller"); scroller.setAccessible(true); scroller.set(this, new OwnScroller(getContext(), millis)); } catch (Exception e) { e.printStackTrace(); } } public class OwnScroller extends Scroller { private int durationScrollMillis = 1; public OwnScroller(Context context, int durationScroll) { super(context, new DecelerateInterpolator()); this.durationScrollMillis = durationScroll; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, durationScrollMillis); } } } }  public class PresentationViewPager extends ViewPager { public static final int DEFAULT_SCROLL_DURATION = 250; public static final int PRESENTATION_MODE_SCROLL_DURATION = 1000; public PresentationViewPager (Context context) { super(context); } public PresentationViewPager (Context context, AttributeSet attrs) { super(context, attrs); } public void setDurationScroll(int millis) { try { Class<?> viewpager = ViewPager.class; Field scroller = viewpager.getDeclairedField("mScroller"); scroller.setAccessible(true); scroller.set(this, new OwnScroller(getContext(), millis)); } catch (Exception e) { e.printStackTrace(); } } public class OwnScroller extends Scroller { private int durationScrollMillis = 1; public OwnScroller(Context context, int durationScroll) { super(context, new DecelerateInterpolator()); this.durationScrollMillis = durationScroll; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, durationScrollMillis); } } } }  public class PresentationViewPager extends ViewPager { public static final int DEFAULT_SCROLL_DURATION = 250; public static final int PRESENTATION_MODE_SCROLL_DURATION = 1000; public PresentationViewPager (Context context) { super(context); } public PresentationViewPager (Context context, AttributeSet attrs) { super(context, attrs); } public void setDurationScroll(int millis) { try { Class<?> viewpager = ViewPager.class; Field scroller = viewpager.getDeclairedField("mScroller"); scroller.setAccessible(true); scroller.set(this, new OwnScroller(getContext(), millis)); } catch (Exception e) { e.printStackTrace(); } } public class OwnScroller extends Scroller { private int durationScrollMillis = 1; public OwnScroller(Context context, int durationScroll) { super(context, new DecelerateInterpolator()); this.durationScrollMillis = durationScroll; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, durationScrollMillis); } } } }  public class PresentationViewPager extends ViewPager { public static final int DEFAULT_SCROLL_DURATION = 250; public static final int PRESENTATION_MODE_SCROLL_DURATION = 1000; public PresentationViewPager (Context context) { super(context); } public PresentationViewPager (Context context, AttributeSet attrs) { super(context, attrs); } public void setDurationScroll(int millis) { try { Class<?> viewpager = ViewPager.class; Field scroller = viewpager.getDeclairedField("mScroller"); scroller.setAccessible(true); scroller.set(this, new OwnScroller(getContext(), millis)); } catch (Exception e) { e.printStackTrace(); } } public class OwnScroller extends Scroller { private int durationScrollMillis = 1; public OwnScroller(Context context, int durationScroll) { super(context, new DecelerateInterpolator()); this.durationScrollMillis = durationScroll; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, durationScrollMillis); } } } }  public class PresentationViewPager extends ViewPager { public static final int DEFAULT_SCROLL_DURATION = 250; public static final int PRESENTATION_MODE_SCROLL_DURATION = 1000; public PresentationViewPager (Context context) { super(context); } public PresentationViewPager (Context context, AttributeSet attrs) { super(context, attrs); } public void setDurationScroll(int millis) { try { Class<?> viewpager = ViewPager.class; Field scroller = viewpager.getDeclairedField("mScroller"); scroller.setAccessible(true); scroller.set(this, new OwnScroller(getContext(), millis)); } catch (Exception e) { e.printStackTrace(); } } public class OwnScroller extends Scroller { private int durationScrollMillis = 1; public OwnScroller(Context context, int durationScroll) { super(context, new DecelerateInterpolator()); this.durationScrollMillis = durationScroll; } @Oviewride public void stairtScroll(int stairtX, int stairtY, int dx, int dy, int duration) { super.stairtScroll(stairtX, stairtY, dx, dy, durationScrollMillis); } } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.