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.
- Android: Qualcomm QCAR (Vuforia) SDK con min3D Framework (u otro 3D-Model / Animation Loader / Renderer)
- Cómo hacer la animación de la barra de herramientas como la aplicación Contactos en Lollipop
- Múltiples animaciones en 1 imageview android
- Android ViewPropertyAnimator no se escala al mismo tiempo
- Tween animación en una lona en una vista personalizada
- Detección de la dirección de desplazamiento en el adaptador (arriba / abajo)
- ¿Cómo implementar TabHost efecto deslizante?
- ¿Cómo hago algo cuando termina una animación?
- Android aplicar color a la animación alfa
- OnAnimationEnd no se llama, onAnimationStart funciona bien
- Circular revela transición para una nueva actividad
- Animación 3D entre actividad en Android
- Problema de hilo simple con la animación de Android
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
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>
- Android descargar pdf de url luego abrirlo con un lector de pdf
- Cómo colocar los elementos de ActionBar en la barra principal de acción y la barra inferior