Android可绘制动画速度控制

时间:2016-03-02 19:28:55

标签: android animation drawable

我在animation.xml中有几张图片

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" >
<item
    android:drawable="@drawable/anim1"
    android:duration="200" />
<item
    android:drawable="@drawable/anim2"
    android:duration="400"/>
<item
    android:drawable="@drawable/anim3"
    android:duration="400"/>

依此类推......在我的MainActivity中

ImageView view = (ImageView) findViewById(R.id.view);
view.setBackgroundResource(R.drawable.view_animation);
AnimationDrawable animation = (AnimationDrawable) view.getBackground();
animation.start();

是否可以保留此表单我的意思是android:duration =&#34; 200&#34;对于第一个图像,然后是android:duration =&#34; 400&#34;对于休息图像,让用户通过微调器选择动画的速度???

0 个答案:

没有答案