0

I am trying to make an animation using an animation list. Looking up how to do this online I have created the following xml in res/anim:

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false"
    >
    <item
        android:drawable="@drawable/loadanim/anim00.png"
        android:duration="10"/>
    <item
        android:drawable="@drawable/loadanim/anim01.png"
        android:duration="10"/>
    <item
        android:drawable="@drawable/loadanim/anim02.png"
        android:duration="10"/>
    ...
</animation-list>

I have added the image sequences for the animation to the /res/drawable directory in a folder called loadanim. When I right click on one of the images and select Copy Reference in Android Studio, I get the path as written in the xml, yet when I try to build the project, I get an error stating that the resources cannot be found.

Can anyone tell me what this might be coming from ?

Radu Chivu
  • 1,057
  • 7
  • 17
  • Dirs inside res can't have sub-dirs. Read [Can the Android drawable directory contain subdirectories?](http://stackoverflow.com/questions/1077357/can-the-android-drawable-directory-contain-subdirectories) –  Aug 08 '14 at 10:17

1 Answers1

1

First, you can't have folders in your /drawable-* folders. So you can't have loadanim folder.

Second, don't write .png.

It should look like so:

android:drawable="@drawable/anim02"
Egor Neliuba
  • 14,784
  • 7
  • 59
  • 77