1、res下创建anim文件夹,在下面创建animation-list的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/firefox_animation_0"        android:duration="500" />    <item android:drawable="@drawable/firefox_animation_1"        android:duration="500" />         </animation-list>        xml文件名可以自用定义;根元素是animation-list,要有多个item元素。     2、在main.xml中创建ImageView组件,并且设置Background   <ImageView android:layout_width="wrap_content"        android:background="@anim/firefox_animation"        android:layout_height="wrap_content" android:id="@+id/ImageView01" />              3、在Java代码中获取ImageView对象,然后ImageView对象获取AnimationDrawable      AnimationDrawable ad = (AnimationDrawable) imgView.getBackground();     4、AnimationDrawable对象启动或停止。   ad.start();   ad.stop();  

更多相关文章

  1. 类和 Json对象
  2. android 通过php 连接 mysql
  3. 【Android】Android中选项菜单(OptionMenu)的创建
  4. Android(安卓)with the NDK_001
  5. Android(安卓)7.0 SystemUI(1)--启动过程
  6. Android(安卓)系统服务 - Input 事件的分发过程
  7. Android(安卓)系统服务 - PMS 的启动过程
  8. android地图,判断坐标是否在你要求的范围内
  9. Call的作用

随机推荐

  1. Android事件1-开发指南-用户界面-事件处
  2. android 渠道包自动化测试流程图
  3. 从原生APK反编译,拿到界面,用于mono for
  4. Android城市联动,城市列表展示
  5. android linux 基础知识总结(2)
  6. 详解Activity的四种启动模式
  7. Could not load 'clearsilver-jni' java.
  8. [置顶] android下调试3G之USB串口驱动集
  9. Android二维码扫描功能的集成开发
  10. Android中activity的启动模式