私は動物の動きを表す3つの画像を作成しました。各画像はフレームを表し、透明な背景を持つ動物だけで構成されています。AnimationDrawableのソースが変更されたAndroid Imageviewのサイズが
私はコードでAnimationDrawableを作り、アニメーションを作成しました:
AnimationDrawable staticAnimation = new AnimationDrawable(); staticAnimation.addFrame(ctx.getResources().getDrawable("frame1"),150); staticAnimation.addFrame(ctx.getResources().getDrawable("frame2"),150); staticAnimation.addFrame(ctx.getResources().getDrawable("frame3"),150);
私はImageViewのための背景としてアニメーションを設定しているので
imgAnimal.setBackgroundDrawable(staticAnimation); staticAnimation.start()
それを開始しますフレームの幅が異なります(ステップ移動を再作成する必要があります)。Imageviewはアニメーション内のイメージのサイズを変更するように見えます。言い換えれば、frame1がframe2より大きい場合、frame1はokと表示されますが、frame2はframe1と同じくらい大きく伸びています。本当にひどいですね。
この動作を停止する方法についてのご意見はありますか?ありがとうございました。