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的两种通信方式,并且分别用获取百度网页做了实例.但是在实际应用中,更多的是客户端通过请求的参数来实现在服务端的具体操作,并最终返回数据给客户端.因为我们不 ...

  2. client 如何找到正确的RegionServer(HBase -ROOT-和.META.表)

    在HBase中,大部分的操作都是在RegionServer完成的,Client端想要插入,删除,查询数据都需要先找到相应的RegionServer.什么叫相应的RegionServer?就是管理你要操 ...

  3. C#集合之ArrayList

    C#中之所以有集合这个东东,是因为数组的长度是固定的,而实际需求是,不确定未来这个“数组”的个数,故出现集合这个概念,因为集合的容量会随元素的增加曾倍数增长.C#中有2类常用集合:ArrayList, ...

  4. 获取文件sha1 值

    单元 IdHashSHA申明 function GetFile_SHA1(const iFileName: String): String; //Checksum hash value for fir ...

  5. Linq JsRender

    http://blog.csdn.net/linfei721/article/details/8973683

  6. 准备Activiti的开发环境

    1.创建项目

  7. FreeMarker在JAVA中应用入门

    在项目中通常有生成XML文件发送到另一个系统的需求,简单的办法可以是用一个XML模板,通过Freemarker替换其中的'Mark'(${}),生成最终的XML文件. 下面记录了一下简单的示例步骤: ...

  8. php header示例代码(推荐)

    <?php /*** Function: PHP header() examples (PHP) ** Desc: Some examples on how to use the header( ...

  9. ssh连接失败解决方法

    执行如下命令: ssh-keygen -t dsa -P '' -f /etc/ssh/ssh_host_dsa_key ssh-keygen -t rsa -P '' -f /etc/ssh/ssh ...

  10. Android Studio API 文档_下载与使用

    如何下载API 说明: 时间: 2016/7/9 根据百度经验步骤改编(百度经验), 但是比它更好, 亲测可用 1.1 下载API文档: 1.1.1 SDK Manager 1.1.2 1.1.3 ( ...