android图片闪烁或帧动画

来源:互联网 发布:双拼域名注册大师 编辑:程序博客网 时间:2024/05/14 21:28

remote_recording_transition.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/remote_recording" android:duration="800"></item>  
    <item android:drawable="@drawable/remote_recording_run" android:duration="800"></item> 
</animation-list>  

 android:oneshot="false" 是否循环播放,flase是循环播放 true只播一次

android:duration="800" 间隔时间

java代码

private AnimationDrawable recordingTransition;

recording=(ImageView)findViewById(R.id.recording);

recording.setBackgroundResource(R.drawable.remote_recording_transition);

recordingTransition = (AnimationDrawable) recording.getBackground();

recordingTransition.start();


--------------------------可以加我微信号:googlecao 进行交流------------------------

                       微笑 如果你觉得此文章对你有用,给我点动力,请我喝杯奶茶咯微笑


原创粉丝点击