0
Ich muss 2 Ansichten animieren und ich möchte die Animation zusammen starten. Hier sind meine zwei Animationen:Animation in verschiedenen Ansichten zusammen
ScaleAnimation scaleAnimation1 = new ScaleAnimation(image.getScaleX(), 1.0f, image.getScaleY(), 1.0f,Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(300);
scaleAnimation.setFillAfter(true);
scaleAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
image.startAnimation(scaleAnimation);
ScaleAnimation scaleAnimation2 = new ScaleAnimation(logo.getScaleX(), 1.0f, logo.getScaleY(), 1.0f,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(300);
scaleAnimation.setFillAfter(true);
scaleAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
logo.startAnimation(scaleAnimation);
Wie kann ich es tun? Ich muss es programmatisch machen.
P.S. Ich habe nicht viel Erfahrung in der Animation.
Schauen Sie sich diese Beispiel: http://cogitolearning.co.uk/?p=1194 –
@ItzikSamara, das zum Ausführen von zwei Animationen sim ist auf einer einzigen Ansicht. Ich möchte 2 verschiedene Animationen auf 2 verschiedenen Ansichten gleichzeitig starten. –
OK, schau dir dieses Beispiel an: http://Stackoverflow.com/questions/17926117/objectanimator-with-scale-property-makes-bg-black sein ObjectAnimator .. ein bisschen anders, aber ich benutze es funktioniert super. –