动画:Android AnimationDrawable在某些设备上无效

时间:2014-07-15 13:29:09

标签: android android-animation

嘿我正在使用XML动画列表来运行简单的可绘制动画。它在三星Galaxy y(ldpi)和micromax canvas 2(双核,hdpi)等低端设备上运行良好。但它在Micromax canvas a120(四核,xhdpi)中严重滞后。它仅显示第一帧和最后一帧。这是XML:

<?xml version="1.0" encoding="UTF-8"?>
<animation-list android:id="@+id/selected8" android:oneshot="true"    xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/smile" android:duration="20" />
<item android:drawable="@drawable/smile1" android:duration="20" />
<item android:drawable="@drawable/smile2" android:duration="20" />
<item android:drawable="@drawable/smile3" android:duration="20" />
<item android:drawable="@drawable/smile4" android:duration="20" />
<item android:drawable="@drawable/smile5" android:duration="20" />
<item android:drawable="@drawable/smile6" android:duration="20" />
<item android:drawable="@drawable/smile7" android:duration="20" />
<item android:drawable="@drawable/smile8" android:duration="20" />
<item android:drawable="@drawable/smile9" android:duration="20" />

</animation-list>

这是java代码:

  imgView1.setBackgroundResource(imageResource);
  frameAnimation = (AnimationDrawable) imgView1.getBackground();
  imgView1.post(new Runnable() {
    @Override
    public void run() {
     imgView1.setVisibility(View.VISIBLE);

     frameAnimation.start();

        }
   });

如何让所有设备的动画均匀?在此先感谢:)

0 个答案:

没有答案