嗨我相当新的android我有一个活动使用帧动画但每次强制关闭。这是logcat
12-16 19:22:38.045 28183-28183/com.martinsapp.socialstories E/dalvikvm-heap﹕
Out of memory on a 13271056-byte allocation.
12-16 19:22:38.055 28183-28183/com.martinsapp.socialstories E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.martinsapp.socialstories/com.martinsapp.socialstories.duckActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2224)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2274)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5153)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at
这只是说图像太大了?
@weston是的我这是使用
的drawable.xml文件<animation-list
android:id="@+id/movingduck"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/movingduck1" android:duration="250"/>
<item android:drawable="@drawable/movingduck2" android:duration="250"/>
<item android:drawable="@drawable/movingduck3" android:duration="250"/>
<item android:drawable="@drawable/movingduck4" android:duration="250"/>
<item android:drawable="@drawable/movingduck5" android:duration="250"/>
<item android:drawable="@drawable/movingduck6" android:duration="250"/>
<item android:drawable="@drawable/movingduck7" android:duration="250"/>
<item android:drawable="@drawable/movingduck8" android:duration="250"/>
答案 0 :(得分:0)
你必须非常积极地缩放图像和帧率才能获得能够毫无例外地在回到Froyo的设备上运行的东西。在240x320的范围内考虑更多,大约10帧。这是每个图像约300k字节。不要认为你是明确的,因为png在磁盘上只有24K,每帧消耗的内存是未压缩的大小(W x H x 4bytes / pix)。