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:
@@ -858,7 +858,8 @@
|
||||
<!-- ANDROID.ANIMATION PACKAGE SAMPLES -->
|
||||
<!-- ************************************* -->
|
||||
|
||||
<activity android:name=".animation.AnimationLoading" android:label="Animation/Loading">
|
||||
<activity android:name=".animation.AnimationLoading" android:label="Animation/Loading"
|
||||
android:hardwareAccelerated="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -866,29 +867,24 @@
|
||||
</activity>
|
||||
|
||||
<activity android:name=".animation.AnimationCloning"
|
||||
android:label="Animation/Cloning">
|
||||
android:label="Animation/Cloning"
|
||||
android:hardwareAccelerated="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".animation.AnimationCloning"
|
||||
android:label="Animation/Cloning">
|
||||
<activity android:name=".animation.AnimationSeeking" android:label="Animation/Seeking"
|
||||
android:hardwareAccelerated="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".animation.AnimationSeeking" android:label="Animation/Seeking">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".animation.AnimatorEvents" android:label="Animation/Events">
|
||||
<activity android:name=".animation.AnimatorEvents" android:label="Animation/Events"
|
||||
android:hardwareAccelerated="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -896,7 +892,8 @@
|
||||
</activity>
|
||||
|
||||
<activity android:name=".animation.BouncingBalls"
|
||||
android:label="Animation/Bouncing Balls">
|
||||
android:label="Animation/Bouncing Balls"
|
||||
android:hardwareAccelerated="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -904,7 +901,8 @@
|
||||
</activity>
|
||||
|
||||
<activity android:name=".animation.CustomEvaluator"
|
||||
android:label="Animation/Custom Evaluator">
|
||||
android:label="Animation/Custom Evaluator"
|
||||
android:hardwareAccelerated="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -918,7 +916,8 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".animation.ReversingAnimation" android:label="Animation/Reversing">
|
||||
<activity android:name=".animation.ReversingAnimation" android:label="Animation/Reversing"
|
||||
android:hardwareAccelerated="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -926,7 +925,8 @@
|
||||
</activity>
|
||||
|
||||
<activity android:name=".animation.MultiPropertyAnimation"
|
||||
android:label="Animation/Multiple Properties">
|
||||
android:label="Animation/Multiple Properties"
|
||||
android:hardwareAccelerated="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user