I am using an animationlistener with INFINITE repeat settings and it is important that every time it loops the onAnimationRepeat function is called.
This all works well with the animattion duration set to ~100ms or higher. Any smaller value I set (e.g. 30开发者_运维技巧ms) still seems to be around 100ms. I tried this on device and on emulator.
I am using an Alphaanimation but i also tried other types of android animations.
Is there a way to make any animation work properly with a duration set around 50ms and faster?
AlphaAnimation is a fairly resource-intensive animation compared to other "sliding" animations.
You may try investigating with TraceView to see exactly where it is getting hung up.
I suspect that it is simply the overhead of the animation that is slowing everything down.
Give the TraceView a shot, report back with results and I'll see if I can give further advice.
Hope this helps!
I know this is old, but for people googling around like I am now.
Try adding this into the animation xml:
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
Correct me if I'm wrong but i think it works for both Translate and Alpha
Example:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="100%p"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="300"/>
</set>
精彩评论