Estoy tratando de hacer una visualización de imagen que gira mientras se desliza por la pantalla. Configuro una animación de rotación de 180 grados, y funciona por sí mismo. Configuro una animación de traducción y funciona solo. Cuando los combino obtengo una imagen que hace una gran espiral. Me gustaría que la vista de la imagen gire alrededor del centro de la imagen mientras se traduce.¿Cómo puedo obtener una imagen para rotar mientras traduzco en Android?
AnimationSet animSet = new AnimationSet(true);
//Translate upwards and to the right.
TranslateAnimation anim =
new TranslateAnimation(
Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, +80.0f,
Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, -100.0f
);
anim.setInterpolator(new DecelerateInterpolator());
anim.setDuration(400);
animSet.addAnimation(anim);
//Rotate around center of Imageview
RotateAnimation ranim = new RotateAnimation(0f, 180f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); //, 200, 200); // canvas.getWidth()/2, canvas.getHeight()/2);
ranim.setDuration(400);
ranim.setInterpolator(new DecelerateInterpolator());
animSet.addAnimation(ranim);
imageBottom.startAnimation(animSet);
tenía el mismo problema, y esto lo solucionó. – tipu