Android Studio报Element XXXX must

2016-08-04  本文已影响191人  b810b03a141c

今天从Eclipse上移植了一个我以前写的Demo,发现在as中会出现:
Element animation-list must be declared
在编写帧动画的xml文件时,将动画的xml文件放到了 res/anim目录中,我的xml如下:

<?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/vol_0" android:duration="300" />
    <item android:drawable="@drawable/vol_1" android:duration="300" />
    <item android:drawable="@drawable/vol_2" android:duration="300" />
</animation-list>

这就出现了:Element animation-list must be declared
后面搜索了一下后就知道了原因,是因为在as中检测资源文件更严格,所以会出现这个错误,不过我们只需要移植到drawable文件下就好了。
把这些资源文件移动到drawable资源文件夹下即得到解决。

转自:http://www.lovecoder.cn/838.html

上一篇下一篇

猜你喜欢

热点阅读