Android 在安卓系统中可以通过声音绘制动画?
我在课堂上使用了动画绘制功能 我需要在加载动画的每一帧时生成声音。无论是否可能。我使用以下代码制作动画:Android 在安卓系统中可以通过声音绘制动画?,android,android-widget,animationdrawable,Android,Android Widget,Animationdrawable,我在课堂上使用了动画绘制功能 我需要在加载动画的每一帧时生成声音。无论是否可能。我使用以下代码制作动画: <?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"> <it
<?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();
}
}