Cómo mover una imagen de izquierda a derecha en android

Me gustaría traducir una imagen de izquierda a derecha en el emulador usando animación androide. Soy nuevo en la animación de Android. ¿Cómo podría hacer eso?

Gracias.

ll = new LinearLayout(this); ll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); ll.setOrientation(LinearLayout.VERTICAL); tv = new TextView(this); tv.setText("Animation"); moveLefttoRight = new TranslateAnimation(0, 200, 0, 0); moveLefttoRight.setDuration(1000); moveLefttoRight.setFillAfter(true); button = new Button(this); button.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); button.setText("PressMe"); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { tv.startAnimation(moveLefttoRight); } }); ll.addView(tv); ll.addView(button); setContentView(ll); 

Es una manera de hacerlo.

Mover una imagen de izquierda a derecha y de derecha a izquierda utilizando Android TranslateAnimation

Introduzca aquí la descripción de la imagen

 ImageView img_animation = (ImageView) findViewById(R.id.img_animation); TranslateAnimation animation = new TranslateAnimation(0.0f, 400.0f, 0.0f, 0.0f); // new TranslateAnimation(xFrom,xTo, yFrom,yTo) animation.setDuration(5000); // animation duration animation.setRepeatCount(5); // animation repeat count animation.setRepeatMode(2); // repeat animation (left to right, right to left ) //animation.setFillAfter(true); img_animation.startAnimation(animation); // start animation 

Usted puede encontrar más detalles de aquí

Añadir este código R.anim folder

 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator" android:fillAfter="true"> <translate android:fromXDelta="0%p" android:toXDelta="100%p" android:duration="800" /> </set> 
  • Animación superpuesta a una actividad de la cámara
  • Android L acción elementos de animación
  • Fragmento que reemplaza la edición de animación
  • Animar las dimensiones superior e inferior de una vista
  • Animación de página curl a Layouts
  • TranslateAnimated ImageView no se puede hacer clic después de la animación
  • Android - Arrastrar y soltar - Animación sombra a destino
  • ListView animar elemento único
  • Cómo hacer que el efecto de cambio de página en Android?
  • Fragmento: Nombre de animación desconocido objectanimator
  • Cómo hacer un gesto de deslizamiento en el elemento RecyclerView sin librería de terceros
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.