0

画像フレームの数を設定して、RelativeLayout背景画像をアニメーション化できるようにしようとしています。

これが私がアニメーションを設定する方法です

private View fullView;
fullView = (View)findViewById(R.id.fullView);

Resources res = getResources();
            Drawable drawable = res.getDrawable(R.drawable.eng_anim_1);
            drawable.setAlpha(100);

            fullView.setBackgroundDrawable(drawable);
            AnimationDrawable progressAnimation = (AnimationDrawable) fullView.getBackground();
            progressAnimation.start();

これが私の「画像のリスト」です

<?xml version="1.0" encoding="utf-8"?>


    <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/selected" android:oneshot="false">
<item android:drawable="@drawable/eng_anim_1" android:duration="50" />
<item android:drawable="@drawable/eng_anim_2" android:duration="50" />
<item android:drawable="@drawable/eng_anim_3" android:duration="50" />
<item android:drawable="@drawable/eng_anim_5" android:duration="50" />
<item android:drawable="@drawable/eng_anim_6" android:duration="50" />
<item android:drawable="@drawable/eng_anim_7" android:duration="50" />
<item android:drawable="@drawable/eng_anim_8" android:duration="50" />
<item android:drawable="@drawable/eng_anim_9" android:duration="50" />
<item android:drawable="@drawable/eng_anim_10" android:duration="50" />
<item android:drawable="@drawable/eng_anim_11" android:duration="50" />
<item android:drawable="@drawable/eng_anim_12" android:duration="50" />
<item android:drawable="@drawable/eng_anim_13" android:duration="50" />
<item android:drawable="@drawable/eng_anim_14" android:duration="50" />
<item android:drawable="@drawable/eng_anim_15" android:duration="50" />
<item android:drawable="@drawable/eng_anim_16" android:duration="50" />
<item android:drawable="@drawable/eng_anim_17" android:duration="50" />
<item android:drawable="@drawable/eng_anim_18" android:duration="50" />
<item android:drawable="@drawable/eng_anim_19" android:duration="50" />
<item android:drawable="@drawable/eng_anim_20" android:duration="50" />

</animation-list>

しかし、問題は、次のエラーが発生することです

08-04 19:03:51.582: E/AndroidRuntime(504): FATAL EXCEPTION: main
08-04 19:03:51.582: E/AndroidRuntime(504): java.lang.RuntimeException: Unable to start activity ComponentInfo{yohanSoftware.languageGame/yohanSoftware.languageGame.Game}: java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable
08-04 19:03:51.582: E/AndroidRuntime(504):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
08-04 19:03:51.582: E/AndroidRuntime(504):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
08-04 19:03:51.582: E/AndroidRuntime(504):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-04 19:03:51.582: E/AndroidRuntime(504):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
08-04 19:03:51.582: E/AndroidRuntime(504):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-04 19:03:51.582: E/AndroidRuntime(504):  at android.os.Looper.loop(Looper.java:123)
08-04 19:03:51.582: E/AndroidRuntime(504):  at android.app.ActivityThread.main(ActivityThread.java:3683)
08-04 19:03:51.582: E/AndroidRuntime(504):  at java.lang.reflect.Method.invokeNative(Native Method)
08-04 19:03:51.582: E/AndroidRuntime(504):  at java.lang.reflect.Method.invoke(Method.java:507)
08-04 19:03:51.582: E/AndroidRuntime(504):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-04 19:03:51.582: E/AndroidRuntime(504):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-04 19:03:51.582: E/AndroidRuntime(504):  at dalvik.system.NativeStart.main(Native Method)
08-04 19:03:51.582: E/AndroidRuntime(504): Caused by: java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable
08-04 19:03:51.582: E/AndroidRuntime(504):  at yo.lang.Game.setUI(Game.java:236)
08-04 19:03:51.582: E/AndroidRuntime(504):  at yo.lan.Game.onCreate(Game.java:127)
08-04 19:03:51.582: E/AndroidRuntime(504):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-04 19:03:51.582: E/AndroidRuntime(504):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
08-04 19:03:51.582: E/AndroidRuntime(504):  ... 11 more

なぜこれを取得しているのかわかりません。

4

1 に答える 1