android帧动画相对简单,只是将资源中的图片文件依据一定规则播放,类似GIF文件。

首先定义ani.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/aboutdlg_logo" android:duration="500"/>    <item android:drawable="@drawable/actionbar_logo" android:duration="500"/>    <item android:drawable="@drawable/aboutdlg_logo" android:duration="500"/>    <item android:drawable="@drawable/actionbar_logo" android:duration="500"/></animation-list>

然后进行调用:

public class MainActivity extends Activity {        private ImageView imageView;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);                 imageView = (ImageView)findViewById(R.id.image);        imageView.setBackgroundResource(R.anim.ani);        AnimationDrawable animationDrawable = (AnimationDrawable)           imageView.getBackground();        animationDrawable.start();    }}

更多相关文章

  1. 一款常用的 Squid 日志分析工具
  2. GitHub 标星 8K+!一款开源替代 ls 的工具你值得拥有!
  3. RHEL 6 下 DHCP+TFTP+FTP+PXE+Kickstart 实现无人值守安装
  4. Linux 环境下实战 Rsync 备份工具及配置 rsync+inotify 实时同步
  5. unity实现android虚拟现实应用
  6. ProgressBar自定义样式中的层叠图片显示问题
  7. 自定义ViewGroup获取子View参数
  8. init 分析2
  9. android > ListView > 加载res图标

随机推荐

  1. Android 调试错误: java.lang.SecurityEx
  2. Android room操作数据库
  3. Android通过Servlet连接MySQL 实现登陆/
  4. android webview ZoomButtonsController
  5. Android开发之Intent.Action
  6. Android(安卓)JNI编程提高篇之二
  7. JRuby on Java ME/CDC
  8. android:visibility
  9. Android作为HTTP服务器--NanoHTTPD源码分
  10. Android 播放提示音