Sto cercando di creare un'immagine che ruota mentre scorre sullo schermo. Ho impostato una rotazione dell'animazione per 180 gradi e funziona da sola. Ho impostato un'animazione di traduzione e funziona da sola. Quando li combino ho una visione d'immagine che fa una grande spirale. Vorrei che la vista panoramica ruotasse attorno al centro della vista immagine durante la traduzione.Come faccio a ruotare un'immagine vista durante la traduzione in 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);
aveva lo stesso problema e questo lo ha risolto. – tipu