0
私のビューの背景色を変更しようとしています。私はいくつかのコードを書いて、アニメーションで色を変えることができますが、初めて色が変わる前に私の見解は凍っています。ビューで背景を変更できません
changeBackgroundColorWithAnimation(300, TransferFragmentNewVersion.rootLayout,
Color.parseColor("#E6000000"), Color.WHITE);
私は背景色が変更された言ったように、しかし、初めてのビューが凍結される(初回のみ)リットル
:これは私のコード
私はこのように私の関数を呼び出すprivate void changeBackgroundColorWithAnimation(int duration, final View view, int startColor, int endColor) {
ValueAnimator anim = new ValueAnimator();
anim.setIntValues(startColor, endColor);
anim.setEvaluator(new ArgbEvaluator());
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(final ValueAnimator valueAnimator) {
view.setBackgroundColor((Integer) valueAnimator.getAnimatedValue());
}
});
anim.setDuration(duration);
anim.start();
}
です問題を解決するにはどうしたらいいですか?みんな、ありがとう。