Ich versuche eine Bildansicht zu erstellen, die sich dreht, während Sie über den Bildschirm gleiten. Ich richte eine Drehanimation für 180 Grad ein, und es funktioniert von selbst. Ich habe eine Übersetzungs-Animation eingerichtet und sie funktioniert von selbst. Wenn ich sie kombiniere, bekomme ich eine Bildansicht, die eine große Spirale macht. Ich möchte, dass die Bildansicht während der Übersetzung um die Bildmitte gedreht wird.Wie kann ich beim Übersetzen in Android eine Bildansicht drehen lassen?
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);
hatte dasselbe Problem, und das hat es behoben. – tipu