私はAndroidで助けが必要です。 私はスロットマシンゲームを作成しようとしています。だから、私はAnimationDrawableを3つのホイールに使用しています。ここでanimwheel.xmlファイルは次のとおりです。Android:AnimationDrawableで現在のフレームを取得する方法
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/animWheel"
android:oneshot="false" >
<item
android:drawable="@drawable/fruits1"
android:duration="200"/>
<item
android:drawable="@drawable/fruits2"
android:duration="200"/>
<item
android:drawable="@drawable/fruits3"
android:duration="200"/>
</animation-list>
私は属性アンドロイドを使用して、メインのレイアウトで3つの異なるビュー(3 whells)でアニメーションリストをパット:背景
今android:background="@drawable/animwheel"
、ユーザーは3つの異なるボタンをクリックしてアニメーションを停止できます。問題は、ビューが現在表示している画像がどの画像か分かりますか? getCurrentFrame()メソッドなどがありますか?
ありがとうございます!
ここでAnimationDrawable(http://goo.gl/e7kFU)を読んだ後、現在のアニメーションフレームを追跡する変数名mCurFrameがあることがわかります。しかし残念ながら、それは私的です。彼らはそれを公開として設定するとより便利になるでしょう。 – anticafe