List of usage examples for android.view.animation AnimationSet setRepeatMode
@Override public void setRepeatMode(int repeatMode)
From source file:Main.java
private static void ApplyHorizontalScrollAnimation(View view, boolean left, int speed) { float sign = left ? 1f : -1f; AnimationSet animationSet = new AnimationSet(true); animationSet.setRepeatCount(Animation.INFINITE); animationSet.setRepeatMode(Animation.RESTART); TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f, Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0); move.setStartOffset(0);//from w ww. jav a2 s .c o m move.setDuration(speed); move.setFillAfter(true); animationSet.addAnimation(move); view.startAnimation(animationSet); }