1.XML文件中:

\res\anim\anim_rotate_refresh.xml

<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"><rotateandroid:duration="1000"android:fromDegrees="0"android:interpolator="@android:anim/linear_interpolator"android:pivotX="50%"android:pivotY="50%"android:repeatCount="infinite"android:repeatMode="restart"android:toDegrees="360"/></set>

2.Java文件中使用:

private ImageView mRefresh;private Animation mRefreshAnim;mRefresh = (ImageView) findViewById(R.id.search_refresh);mRefreshAnim = AnimationUtils.loadAnimation(mContext, R.anim.anim_rotate_refresh);public void stopAnim() {mRefreshAnim.reset();mRefresh.clearAnimation();mRefresh.setBackgroundResource(R.drawable.search);}public void startAnim() {mRefreshAnim.reset();mRefresh.clearAnimation();mRefresh.setBackgroundResource(R.drawable.search_refresh);mRefresh.startAnimation(mRefreshAnim);}


更多相关文章

  1. 箭头函数的基础使用
  2. NPM 和webpack 的基础使用
  3. Python list sort方法的具体使用
  4. 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
  5. 读取android手机流量信息
  6. android 使用html5作布局文件: webview跟javascript交互
  7. Android(安卓)多媒体扫描过程(Android(安卓)Media Scanner Proces
  8. android“设置”里的版本号
  9. Android开发环境搭建

随机推荐

  1. Android(安卓)Ashmem相关介绍
  2. Android仿微信添加联系人列表,内附有截图
  3. Android(安卓)根证书管理与证书验证
  4. Android应用程序用户界面(十二)菜单
  5. 【Android】ColorPickerDialog 自定义颜
  6. [Android(安卓)数据通信] android cmwap
  7. [Android]日志分类(Amdroid Studio)
  8. Unity3D中 Android插件findviewbyid返回n
  9. Android中圆形图的几种实现方式
  10. 第3.1.3节 排布视图