public class MainActivity extends Activity {
private Button button = null;
private ImageView imageView = null; @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
imageView = (ImageView) findViewById(R.id.imageViewId);
button = (Button) findViewById(R.id.scaleButtonId);
button.setOnClickListener(new AnimationButtonListener());
} private class AnimationButtonListener implements OnClickListener { @Override
public void onClick(View v) {
/**
* Animation animation =
* AnimationUtils.loadAnimation(MainActivity.this, R.anim.alpha);
* imageView.startAnimation(animation);
*/
// 声明一个AnimationSet对象
AnimationSet animationSet = new AnimationSet(false);
AlphaAnimation alpha = new AlphaAnimation(1.0f, 0.0f);
alpha.setInterpolator(new DecelerateInterpolator());
RotateAnimation rotate = new RotateAnimation(0, 360,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setInterpolator(new AccelerateInterpolator());
animationSet.addAnimation(alpha);
animationSet.addAnimation(rotate);
animationSet.setDuration(2000);
animationSet.setStartOffset(500);
imageView.startAnimation(animationSet);
} }
}

ANDROID_MARS学习笔记_S02_009_Animation_Interpolator的更多相关文章

  1. ANDROID_MARS学习笔记_S01_012_RatingBar

    1.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns: ...

  2. ANDROID_MARS学习笔记_S01_012_SeekBar

    1.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns: ...

  3. ANDROID_MARS学习笔记_S01_011ProgressBar

    文档是这样来设置样式 <ProgressBar android:layout_width="wrap_content" android:layout_height=" ...

  4. ANDROID_MARS学习笔记_S01_010日期时间控件

    1.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns: ...

  5. ANDROID_MARS学习笔记_S01_009Relative_LAYOUT例子

    1. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android ...

  6. ANDROID_MARS学习笔记_S01_008Linear_layout例子

    1.netstone_layout.xml <?xml version="1.0" encoding="utf-8"?> <LinearLay ...

  7. ANDROID_MARS学习笔记_S01_007Linear_layout嵌套与layout_weight的设置

    一.介绍 二.1.linear_layout.xml <?xml version="1.0" encoding="utf-8"?> <Line ...

  8. ANDROID_MARS学习笔记_S01_006ImageView

    一.ImageView介绍 设置scalType Must be one of the following constant values. Constant Value Description ma ...

  9. ANDROID_MARS学习笔记_S01_005CheckBox

    一. 1.checkbox_layout.xml <?xml version="1.0" encoding="utf-8"?> <Linear ...

随机推荐

  1. Android之Http网络编程(一)

    Android应用作为一个客户端程序绝大部分都是需要进行网络请求和访问的,而http通信是一种比较常见并常用的通信方式. 在Android中http网络编程中有两种实现方式,一种是使用HttpURLC ...

  2. 捕获JSON 解析错误

    $json = <<<JSON { "origin":"Delhi", "destination":"Londo ...

  3. ###Fedora下安装Retext

    使用Markdown. #@date: 2012-05-07 #@author: gr #@email: forgerui@gmail.com 因为习惯了Markdown的简单,所以需要在自己的Fed ...

  4. cocos2d-x实战 C++卷 学习笔记--第6章 场景与层

    前言: 一个场景(Scene)是由多个层(Layer)组成,而且层的个数要至少是1,不能为0. 场景切换 场景切换相关函数 1)void  runWithScene(Scene*  scene) 该函 ...

  5. 02线性表链式存储_LinkList--(线性表)

    #include "stdio.h" #include "string.h" #include "ctype.h" #include &qu ...

  6. TextView实现跑马灯效果

    网上有很多跑马灯的介绍,有很多跑马灯的代码.或许我的不是最好的,但是应该很容易明白的. 我们先来介绍一个跑马灯的代码 <LinearLayout xmlns:android="http ...

  7. JS 日期格式转换

    //Json 数据年月日 返回 直接传入参数 如/Date(1379433600000)/ function GetDate(date) { if (date == null) return null ...

  8. A-frame_02

    A-Frame 让我们能够仅仅通过几行HTML代码创建出可以运行在桌面, 虚拟眼镜, 以及手机上的VR场景. 而且因为这个框架是基于HTML的, 我们也可以像一般的HTML元素一样配合JavaScri ...

  9. 使用weinre通过PC浏览器调试手机网页

    Weinre是什么? Weinre代表Web Inspector Remote,是一种远程调试工具.举个例子,在电脑上可以即时的更改手机上对应网页的页面元素.样式表, 或是查看Javascript变量 ...

  10. C#线程总结

    using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using S ...