Reputation: 6359
Since API16 ImageView.setImageAlpha(int) should be used instead of View.setAlpha(float) for better performance.
But how can I animate that value? I tried ValueAnimator without success.
ObjectAnimator.ofInt(imageView, "imageAlpha", 0).start();
I mean what Chet Haase is talking about here http://youtu.be/vQZFaec9NpA?t=33m
Upvotes: 3
Views: 1232
Reputation: 16537
It should be fine. Maybe you forgot to specify the animation duration, or your alpha values are wrong (negative, too small, too close to notice)?
You can always animate using custom listener. It's longer, but easier to debug:
ValueAnimator animator = ValueAnimator.ofInt(0,255);
animator.setDuration(300);
animator.setInterpolator(new DecelerateInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
imageView.setImageAlpha(valueAnimator.getAnimatedValue());
}
});
animator.start();
Upvotes: 4