标签:art 显示 als 播放 list oid odi ima resource
<?xml version="1.0" encoding="utf-8"?>
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<!--oneshot:控制播放次数 true:播放一次,false:重复不停的播放-->
<!--duration:每张图片持续时长-->
<item
android:drawable="@mipmap/icon_num_1"
android:duration="500" />
<item
android:drawable="@mipmap/icon_num_2"
android:duration="500" />
<item
android:drawable="@mipmap/icon_num_3"
android:duration="500" />
</animation-list>
AnimationActivity(activity中获取为指定的ImageView设置帧动画)
public class AnimationActivity extends BaseActivity {
private ImageView ivDemo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_animation);
ivDemo = findViewById(R.id.ivDemo);
}
//帧动画
public void btDrawable(View view) {
ivDemo.setBackgroundResource(R.drawable.animation_drawable1);
AnimationDrawable animation = (AnimationDrawable) ivDemo.getBackground();
animation.start();
}
}
标签:art 显示 als 播放 list oid odi ima resource
原文地址:https://www.cnblogs.com/io1024/p/11577743.html