/ /アニメーションはアンドロイドの音で描ける? - アンドロイド、アンドロイドウィジェット、アニメーション描画可能

アンドロイドのサウンドでアニメーション描くことができますか? - 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">
<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>

私のJava:

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();


}
}

どこで音を出すのかわからない。

誰もがいくつかのアイデアを提案します。

ありがとう。

回答:

回答№1は0

私はそれをハンドラを使って実現しました。ハンドラ内では、サウンドを開始して再生し、各アニメーションフレームの間ハンドラメッセージを遅らせます。それはうまくいっています。