breakline
breakline

Reputation: 6073

Android animations and screen rotation

I have animated some properties with AnimatorSet (simple fade-in, fade-out etc.) but when I change the screen rotation my activity always goes back to its starting layout. Is there something I'm missing here?

ObjectAnimator fadeOut = ObjectAnimator.ofFloat(loginBtn, "alpha", 1f, 0f);
    fadeOut.setDuration(300);
    ObjectAnimator fadeIn = ObjectAnimator.ofFloat(backBtn, "alpha", 0f, 1f);
    fadeIn.setDuration(300);
    final AnimatorSet mAnimationSet = new AnimatorSet();
    mAnimationSet.play(fadeOut).with(fadeIn);
    mAnimationSet.start();

Upvotes: 0

Views: 1027

Answers (1)

Ravindra Kushwaha
Ravindra Kushwaha

Reputation: 8032

Use these code in the yours manifest file(in the yours activity class) than data will not change in the both mode of the mobile(landscape or portrait)

android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMod

OR USE SIMPLY THESE

android:configChanges="orientation|screenSize|screenLayout"

Upvotes: 2

Related Questions