【发布时间】:2013-05-24 00:48:27
【问题描述】:
我有一个简单的 .xml 布局文件,其中包含一个简单的 ImageView,我想打开该文件。我决定继续使用 FrameAnimations,使用 AnimationDrawable API。
我已经设法在“drawable/file.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/image_010_1" android:duration="1000" />
<item android:drawable="@drawable/image_010_2" android:duration="1000" />
</animation-list>
现在,下面是应该启动我的动画的代码:
Image1.setBackgroundResource(R.drawable.image_010);
AnimationDrawable animation = (AnimationDrawable) Image1.getBackground();
animation.start();
由于某种原因,当我运行该应用程序时,我只看到第一帧,而下一张图像在 1000 英里之后没有出现,或者根本没有出现!我究竟做错了什么?谢谢!
【问题讨论】:
标签: android android-imageview animationdrawable