我在课堂上使用动画可绘制功能。
我需要在加载每一帧动画时生成声音。无论是否可能。我将以下代码用于动画:
<?xml version="1.0" encoding="utf-8"?>
<animation-list android:id="@+id/handimation" android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/count3" android:duration="650" />
<item android:drawable="@drawable/count2" android:duration="650" />
<item android:drawable="@drawable/count1" android:duration="650" />
<item android:drawable="@drawable/go" android:duration="650" />
</animation-list>
我的爪哇:
AnimationDrawable frameAnimation;
ImageView animatedimage ;
animatedimage = (ImageView)findViewById(R.id.rcount);
final MyAnimationRoutineStart animationStart =
new MyAnimationRoutineStart();
final MyAnimationRoutineStop animationStop =
new MyAnimationRoutineStop();
animatedimage.setBackgroundResource(R.drawable.spin);
frameAnimation = (AnimationDrawable) animatedimage.getBackground();
Timer animateTimerStart = new Timer(false);
animateTimerStart.schedule(animationStart, 100);
Timer animateTimerStop = new Timer(false);
animateTimerStop.schedule(animationStop, 2500);
class MyAnimationRoutineStart extends TimerTask
{
MyAnimationRoutineStart()
{
}
public void run()
{
// Start the animation (looped playback by default).
frameAnimation.start();
}
}
class MyAnimationRoutineStop extends TimerTask
{
MyAnimationRoutineStop()
{
}
public void run()
{
frameAnimation.stop();
// stop the animation (looped playback by default).
videoName=camcorderView.startRecording();
counter = 0;
counterFlag = true;
counterThread.start();
}
}
我不知道在哪里产生声音。
任何人提出一些想法。
谢谢。