android - Why is my rotate animation all wonky when applied to an Activity transition? -
what below animation supposed do?
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromdegrees="0" android:todegrees="360" android:pivotx="50%" android:pivoty="50%" android:interpolator="@android:anim/linear_interpolator" android:duration="1000" />
easy enough. should represent clockwise rotation centre. spin around once, stop. right?
and does... when apply view.
but when animate activity transition instead, entirely different happens. activity starts rotate counterclockwise, @ same time flies off top right of screen. comes back, still rotating counterclockwise , upside-down, , flies off bottom left of screen. finally, comes , ends rotation upright.
no matter specify pivotx
, pivoty
, behaviour same. seem ignored completely. , either way, thing not rotating around fixed pivot @ all!
what kind of nonsense this? bug?
for completeness, saved animation res/anim/spin.xml
, , invoke follows:
startactivity(intent); overridependingtransition(r.anim.spin, r.anim.spin);
(using same animation both in , out makes no sense, minimal example.)
update: demo app reproduce issue
i've put minimal android project demonstrates problem. main activity looks this:
package com.example.animtest; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.view.animation.animation; import android.view.animation.animationutils; public class mainactivity extends activity { private view rootview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); rootview = getlayoutinflater().inflate(r.layout.main, null); setcontentview(rootview); } public void animaterootview(view view) { animation spin = animationutils.loadanimation(getapplicationcontext(), r.anim.spin); rootview.setanimation(spin); spin.start(); } public void animateactivity(view view) { intent intent = new intent(); intent.setclassname("com.example.animtest", "com.example.animtest.mainactivity"); startactivity(intent); overridependingtransition(r.anim.spin, r.anim.spin); } }
here zip file project source , runnable apk file. tested on nexus one, android 2.2.2.
known issue .. till 2.3.4 nothing has been done :( http://code.google.com/p/android/issues/detail?id=10402
Comments
Post a Comment