Code example for ArgbEvaluator

Methods: ofObject

0
        final float alpha = a; 
        ValueAnimator anim = null; 
        if (v.getBackground() instanceof BackgroundAlphaColorDrawable) { 
            final BackgroundAlphaColorDrawable bg = (BackgroundAlphaColorDrawable) v 
                    .getBackground(); 
            anim = ValueAnimator.ofObject(new ArgbEvaluator(), info.color, 
                    BackgroundAlphaColorDrawable.applyAlphaToColor(bg.getBgColor(), alpha)); 
            anim.addUpdateListener(new AnimatorUpdateListener() { 
                @Override 
                public void onAnimationUpdate(ValueAnimator animation) { 
                    info.color = (Integer) animation.getAnimatedValue(); 
                    bg.setColor(info.color); 
                } 
            }); 
        } else { 
            // custom image is set by the theme, let's just apply the alpha if we can. 
            v.getBackground().setAlpha(BackgroundAlphaColorDrawable.floatAlphaToInt(alpha)); 
            return null; 
        } 
        anim.addListener(new AnimatorListener() { 
            @Override