Overview: Animation is used to applied to Views, Surfaces, or other objects.
Purpose: Animation can provide a nice UE when the user clicked the button or drag the list.
Instruction:
final Animation anim = new TranslateAnimation(view.getLeft(),
view.getLeft() + distance, 0.0f, 0.0f);
anim.setDuration(1000);
anim.setStartOffset(300);
anim.setRepeatMode(Animation. RESTART );
anim.setAnimationListener( new AnimationListener() {
public void onAnimationStart(Animation animation) {
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationEnd(Animation animation) {
}
});
anim.setRepeatCount(0);
anim.setInterpolator(
AnimationUtils. loadInterpolator (context,
android.R.anim. accelerate_decelerate_interpolator ));
anim.setFillAfter( true );
anim.setFillEnabled( true );
view.startAnimation(anim);