Tuesday, 10 September 2013

Why android animation in my app is not as smooth as goLauncher animations?

Why android animation in my app is not as smooth as goLauncher animations?

I am using animation for item click of GridView. My animation file is
expand_then_contract.xml as below
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<scale
android:duration="500"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.1"
android:toYScale="1.1" />
<scale
android:duration="500"
android:fromXScale="1.1"
android:fromYScale="1.1"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="500"
android:toXScale="1"
android:toYScale="1" />
</set>
And I'm applying it in the onItemClickListener of GridView as below
onItemClick(... View view ..)
{
Animation expand_contract = AnimationUtils.loadAnimation(this,
R.anim.expand_then_contract);
view.bringToFront();
view.clearAnimation();
view.setAnimation(expand_contract);
view.startAnimation(expand_contract);
}
It is working as expected. But it gets stuck in between. At some point
when it is contracting back to normal position, for a moment it freezes.
Why does this happen. Why can't animation in my code work as smoothly as
they make it in GoLauncher Animations. Do they use any external libraries.

No comments:

Post a Comment