Added setColor to ColorDrawable.

Also, set hardwareAccelerated=false for animation demos using ovals
(which are not yet supported through GL)

Change-Id: I710b6be51a14bf02650206bd6bae8841ecd3ac79
This commit is contained in:
Chet Haase
2010-10-28 11:48:52 -07:00
parent 6d36a9ee9b
commit ed20aff7b1
2 changed files with 19 additions and 20 deletions

View File

@@ -18,6 +18,7 @@ package com.example.android.apis.animation;
// Need the following import to get access to the app resources, since this
// class is in a sub-package.
import android.graphics.drawable.ColorDrawable;
import com.example.android.apis.R;
import android.animation.*;
@@ -65,13 +66,11 @@ public class BouncingBalls extends Activity {
super(context);
// Create a colored background
ShapeDrawable background = new ShapeDrawable(new RectShape());
ColorDrawable background = new ColorDrawable(RED);
setBackgroundDrawable(background);
Paint paint = background.getPaint();
paint.setColor(RED);
// Animate background color
ValueAnimator colorAnim = ObjectAnimator.ofInt(paint, "color", BLUE);
ValueAnimator colorAnim = ObjectAnimator.ofInt(background, "color", BLUE);
colorAnim.setDuration(3000);
colorAnim.setEvaluator(new RGBEvaluator());
colorAnim.setRepeatCount(ValueAnimator.INFINITE);